Coverage for certbot/plugins/dns_common.py : 95%

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."""
"""Base class for DNS Authenticators"""
default=default_propagation_seconds, type=int, help='The number of seconds to wait for DNS to propagate before asking the ACME server ' 'to verify the DNS record.')
pass
# DNS updates take time to propagate and checking to see if the update has occurred is not # reliable (the machine this code is running on might be able to see an update before # the ACME server). So: we sleep for a short amount of time we believe to be long enough. self.conf('propagation-seconds'))
def _setup_credentials(self): # pragma: no cover """ Establish credentials, prompting if necessary. """ raise NotImplementedError()
def _perform(self, domain, validation_domain_name, validation): # pragma: no cover """ Performs a dns-01 challenge by creating a DNS TXT record.
:param str domain: The domain being validated. :param str validation_domain_name: The validation record domain name. :param str validation: The validation record content. :raises errors.PluginError: If the challenge cannot be performed """ raise NotImplementedError()
def _cleanup(self, domain, validation_domain_name, validation): # pragma: no cover """ Deletes the DNS TXT record which would have been created by `_perform_achall`.
Fails gracefully if no such record exists.
:param str domain: The domain being validated. :param str validation_domain_name: The validation record domain name. :param str validation: The validation record content. """ raise NotImplementedError()
""" Ensure that a configuration value is available.
If necessary, prompts the user and stores the result.
:param str key: The configuration key. :param str label: The user-friendly label for this piece of information. """
""" Ensure that a configuration value is available for a path.
If necessary, prompts the user and stores the result.
:param str key: The configuration key. :param str label: The user-friendly label for this piece of information. """
""" As `_configure_file`, but for a credential configuration file.
If necessary, prompts the user and stores the result.
Always stores absolute paths to avoid issues during renewal.
:param str key: The configuration key. :param str label: The user-friendly label for this piece of information. :param dict required_variables: Map of variable which must be present to error to display. :param callable validator: A method which will be called to validate the `CredentialsConfiguration` resulting from the supplied input after it has been validated to contain the `required_variables`. Should throw a `~certbot.errors.PluginError` to indicate any issue. """
validator(configuration)
validator(credentials_configuration)
def _prompt_for_data(label): """ Prompt the user for a piece of information.
:param str label: The user-friendly label for this piece of information. :returns: The user's response (guaranteed non-empty). :rtype: str """
__validator, 'Input your {0}'.format(label), force_interactive=True)
else:
""" Prompt the user for a path.
:param str label: The user-friendly label for the file. :param callable validator: A method which will be called to validate the supplied input after it has been validated to be a non-empty path to an existing file. Should throw a `~certbot.errors.PluginError` to indicate any issue. :returns: The user's response (guaranteed to exist). :rtype: str """
__validator, 'Input the path to your {0}'.format(label), force_interactive=True)
else:
"""Represents a user-supplied filed which stores API credentials."""
""" :param str filename: A path to the configuration file. :param callable mapper: A transformation to apply to configuration key names :raises errors.PluginError: If the file does not exist or is not a valid format. """
except configobj.ConfigObjError as e: logger.debug("Error parsing credentials configuration: %s", e, exc_info=True) raise errors.PluginError("Error parsing credentials configuration: {0}".format(e))
"""Ensures that the supplied set of variables are all present in the file.
:param dict required_variables: Map of variable which must be present to error to display. :raises errors.PluginError: If one or more are missing. """
.format(self.mapper(var), required_variables[var])) .format(self.mapper(var), required_variables[var]))
'Missing {0} in credentials configuration file {1}:\n * {2}'.format( 'property' if len(messages) == 1 else 'properties', self.confobj.filename, '\n * '.join(messages) ) )
"""Find a configuration value for variable `var`, as transformed by `mapper`.
:param str var: The variable to get. :returns: The value of the variable. :rtype: str """
"""Ensure that the specified file exists."""
"""Ensure that the specified file exists and warn about unsafe permissions."""
"""Return a list of progressively less-specific domain names.
One of these will probably be the domain name known to the DNS provider.
:Example:
>>> base_domain_name_guesses('foo.bar.baz.example.com') ['foo.bar.baz.example.com', 'bar.baz.example.com', 'baz.example.com', 'example.com', 'com']
:param str domain: The domain for which to return guesses. :returns: The a list of less specific domain names. :rtype: list """
|