Coverage for certbot/plugins/dns_common_lexicon.py : 84%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""Common code for DNS Authenticator Plugins built on Lexicon."""
# Lexicon is not declared as a dependency in Certbot itself, # but in the Certbot plugins backed by Lexicon. # So we catch import error here to allow this module to be # always importable, even if it does not make sense to use it # if Lexicon is not available, obviously.
""" Encapsulates all communication with a DNS provider via Lexicon. """
""" Add a TXT record using the supplied information.
:param str domain: The domain to use to look up the managed zone. :param str record_name: The record name (typically beginning with '_acme-challenge.'). :param str record_content: The record content (typically the challenge validation). :raises errors.PluginError: if an error occurs communicating with the DNS Provider API """
""" Delete a TXT record using the supplied information.
:param str domain: The domain to use to look up the managed zone. :param str record_name: The record name (typically beginning with '_acme-challenge.'). :param str record_content: The record content (typically the challenge validation). :raises errors.PluginError: if an error occurs communicating with the DNS Provider API """ exc_info=True)
""" Find the domain_id for a given domain.
:param str domain: The domain for which to find the domain_id. :raises errors.PluginError: if the domain_id cannot be found. """
# For Lexicon 2.x else: # For Lexicon 3.x self.provider.domain = domain_name
.format(domain, domain_name_guesses))
.format(domain_name, e))
.format(domain_name, e))
# type: (str, Dict, Dict) -> Union[ConfigResolver, Dict] """ Convenient function to build a Lexicon 2.x/3.x config object. :param str lexicon_provider_name: the name of the lexicon provider to use :param dict lexicon_options: options specific to lexicon :param dict provider_options: options specific to provider :return: configuration to apply to the provider :rtype: ConfigurationResolver or dict """ config = {'provider_name': lexicon_provider_name} # type: Dict[str, Any] config.update(lexicon_options) if not ConfigResolver: # Lexicon 2.x config.update(provider_options) else: # Lexicon 3.x provider_config = {} provider_config.update(provider_options) config[lexicon_provider_name] = provider_config config = ConfigResolver().with_dict(config).with_env()
return config |