mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] correctly handle all cases
This commit is contained in:
parent
39aaa17639
commit
7dbbd7fdc2
1 changed files with 12 additions and 3 deletions
|
@ -608,15 +608,24 @@ def _dns_ip_match_public_ip(public_ip, domain):
|
|||
traceback.print_exc(file=sys.stdout)
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('certmanager_error_contacting_dns_api', api="dns-api.org", reason=exception))
|
||||
|
||||
try:
|
||||
dns_ip = result.json()
|
||||
if not dns_ip or "value" not in dns_ip[0]:
|
||||
except Exception as exception:
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('certmanager_error_parsing_dns', domain=domain, value=result.text))
|
||||
|
||||
dns_ip = dns_ip[0]["value"]
|
||||
if len(dns_ip) == 0:
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('certmanager_error_parsing_dns', domain=domain, value=result.text))
|
||||
|
||||
dns_ip = dns_ip[0]
|
||||
|
||||
if dns_ip.get("error") == "NXDOMAIN":
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('certmanager_no_A_dns_record', domain=domain))
|
||||
|
||||
if "value" not in dns_ip:
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('certmanager_error_parsing_dns', domain=domain, value=result.text))
|
||||
|
||||
dns_ip = dns_ip["value"]
|
||||
|
||||
if dns_ip == public_ip:
|
||||
return True
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue