Merge pull request #2177 from castrapel/multiple_dns_providers
Prefer DNS provider with longest matching zone
This commit is contained in:
commit
f944e6aa32
|
@ -215,12 +215,18 @@ class AcmeHandler(object):
|
||||||
:return: dns_providers: List of DNS providers that have the correct zone.
|
:return: dns_providers: List of DNS providers that have the correct zone.
|
||||||
"""
|
"""
|
||||||
self.dns_providers_for_domain[domain] = []
|
self.dns_providers_for_domain[domain] = []
|
||||||
|
match_length = 0
|
||||||
for dns_provider in self.all_dns_providers:
|
for dns_provider in self.all_dns_providers:
|
||||||
if not dns_provider.domains:
|
if not dns_provider.domains:
|
||||||
continue
|
continue
|
||||||
for name in dns_provider.domains:
|
for name in dns_provider.domains:
|
||||||
if domain.endswith("." + name):
|
if domain.endswith("." + name):
|
||||||
|
if len(name) > match_length:
|
||||||
|
self.dns_providers_for_domain[domain] = [dns_provider]
|
||||||
|
match_length = len(name)
|
||||||
|
elif len(name) == match_length:
|
||||||
self.dns_providers_for_domain[domain].append(dns_provider)
|
self.dns_providers_for_domain[domain].append(dns_provider)
|
||||||
|
|
||||||
return self.dns_providers_for_domain
|
return self.dns_providers_for_domain
|
||||||
|
|
||||||
def finalize_authorizations(self, acme_client, authorizations):
|
def finalize_authorizations(self, acme_client, authorizations):
|
||||||
|
|
Loading…
Reference in New Issue