Update Error Handling
Change-Id: Iaf38f552dd17bb7c305bd6d2a543cf2a7941039a
This commit is contained in:
parent
038d7888e4
commit
6e6c761e74
20
README.rst
20
README.rst
@ -4,16 +4,26 @@ certbot-dns-openstack
|
||||
|
||||
OpenStack DNS Authenticator plugin for Certbot
|
||||
|
||||
Please fill here a long description which must be at least 3 lines wrapped on
|
||||
80 cols, so that distribution package maintainers can use it in their packages.
|
||||
Note that this is a hard requirement.
|
||||
To Install:
|
||||
|
||||
``pip install certbot-dns-openstack``
|
||||
|
||||
To run:
|
||||
|
||||
``certbot -a certbot-dns-openstack:dns-openstack certonly -d example.com``
|
||||
|
||||
This uses ``os-client-config`` ``clouds.yaml`` for configuring the user access
|
||||
which by default will look in ``~/.config/openstack/clouds.yaml``,
|
||||
and ``/etc/openstack/clouds.yaml``. If your ``clouds.yaml`` file is stored else
|
||||
where, you can add by adding
|
||||
``--certbot-dns-openstack:dns-openstack-config /path/to/clouds.yaml`` to the
|
||||
command.
|
||||
|
||||
* Free software: Apache license
|
||||
* Documentation: https://docs.openstack.org/certbot-dns-openstack/latest
|
||||
* Source: https://git.openstack.org/cgit/openstack/certbot-dns-openstack
|
||||
* Bugs: https://bugs.launchpad.net/certbot-dns-openstack
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* TODO
|
||||
* dns-01 ACME challenge
|
||||
|
@ -16,6 +16,7 @@ import logging
|
||||
import zope.interface
|
||||
|
||||
from certbot import interfaces
|
||||
from certbot import errors
|
||||
from certbot.plugins import dns_common
|
||||
|
||||
from openstack.config import loader
|
||||
@ -40,7 +41,7 @@ class Authenticator(dns_common.DNSAuthenticator):
|
||||
def add_parser_arguments(cls, add): # pylint: disable=arguments-differ
|
||||
super(Authenticator, cls).add_parser_arguments(
|
||||
add, default_propagation_seconds=30)
|
||||
add('client_config', help='OpenStack Client Config file.')
|
||||
add('config', help='OpenStack Client Config file.')
|
||||
add('cloud', help='OpenStack to use.')
|
||||
|
||||
def more_info(self): # pylint: disable=missing-docstring,no-self-use
|
||||
@ -48,7 +49,7 @@ class Authenticator(dns_common.DNSAuthenticator):
|
||||
'dns-01 challenge using the OpenStack DNS API.'
|
||||
|
||||
def _setup_credentials(self):
|
||||
config_file = self.conf('client_config') or ''
|
||||
config_file = self.conf('config') or ''
|
||||
config = loader.OpenStackConfig(
|
||||
config_files=loader.CONFIG_FILES + [config_file])
|
||||
self.cloud = connection.Connection(
|
||||
@ -58,10 +59,19 @@ class Authenticator(dns_common.DNSAuthenticator):
|
||||
)
|
||||
|
||||
def _perform(self, domain, validation_name, validation):
|
||||
self.zone = self.cloud.get_zone(domain + '.')
|
||||
domain_name_guesses = dns_common.base_domain_name_guesses(domain)
|
||||
for domain in domain_name_guesses:
|
||||
self.zone = self.cloud.get_zone(domain + '.')
|
||||
if self.zone is not None:
|
||||
break
|
||||
if self.zone is None:
|
||||
raise errors.PluginError(
|
||||
'Unable to determine zone identifier for {0} using '
|
||||
'zone names: {1}'.format(domain, domain_name_guesses))
|
||||
self.recordset = self.cloud.create_recordset(
|
||||
self.zone['id'], validation_name + '.', "TXT", [validation])
|
||||
|
||||
def _cleanup(self, domain, validation_name, validation):
|
||||
self.cloud.delete_recordset(
|
||||
self.zone['id'], self.recordset['id'])
|
||||
if getattr(self, 'recordset', False):
|
||||
self.cloud.delete_recordset(
|
||||
self.zone['id'], self.recordset['id'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user