This commit is contained in:
Alexandre Aubin 2021-09-29 22:20:29 +02:00
parent 8eb9e274d4
commit df0cdd483d
3 changed files with 21 additions and 5 deletions

View file

@ -8,7 +8,12 @@ from publicsuffix import PublicSuffixList
from moulinette.utils.process import check_output
from yunohost.utils.dns import dig, YNH_DYNDNS_DOMAINS, is_yunohost_dyndns_domain, is_special_use_tld
from yunohost.utils.dns import (
dig,
YNH_DYNDNS_DOMAINS,
is_yunohost_dyndns_domain,
is_special_use_tld,
)
from yunohost.diagnosis import Diagnoser
from yunohost.domain import domain_list, _get_maindomain
from yunohost.dns import _build_dns_conf, _get_dns_zone_for_domain

View file

@ -873,7 +873,9 @@ def _check_domain_is_ready_for_ACME(domain):
)
base_dns_zone = _get_dns_zone_for_domain(domain)
record_name = domain.replace(f".{base_dns_zone}", "") if domain != base_dns_zone else "@"
record_name = (
domain.replace(f".{base_dns_zone}", "") if domain != base_dns_zone else "@"
)
A_record_status = dnsrecords.get("data").get(f"A:{record_name}")
AAAA_record_status = dnsrecords.get("data").get(f"AAAA:{record_name}")
@ -883,7 +885,11 @@ def _check_domain_is_ready_for_ACME(domain):
if not AAAA_record_status:
AAAA_record_status = dnsrecords.get("data").get(f"AAAA:*")
if not httpreachable or not dnsrecords.get("data") or (A_record_status, AAAA_record_status) == (None, None):
if (
not httpreachable
or not dnsrecords.get("data")
or (A_record_status, AAAA_record_status) == (None, None)
):
raise YunohostValidationError(
"certmanager_domain_not_diagnosed_yet", domain=domain
)
@ -892,7 +898,10 @@ def _check_domain_is_ready_for_ACME(domain):
# - 'MISSING' for IPv6 ain't critical for ACME
# - IPv4 can be None assuming there's at least an IPv6, and viveversa
# - (the case where both are None is checked before)
if not (A_record_status in [None, "OK"] and AAAA_record_status in [None, "OK", "MISSING"]):
if not (
A_record_status in [None, "OK"]
and AAAA_record_status in [None, "OK", "MISSING"]
):
raise YunohostValidationError(
"certmanager_domain_dns_ip_differs_from_public_ip", domain=domain
)

View file

@ -34,7 +34,9 @@ external_resolvers_: List[str] = []
def is_yunohost_dyndns_domain(domain):
return any(domain.endswith(f".{dyndns_domain}") for dyndns_domain in YNH_DYNDNS_DOMAINS)
return any(
domain.endswith(f".{dyndns_domain}") for dyndns_domain in YNH_DYNDNS_DOMAINS
)
def is_special_use_tld(domain):