fix loopia acme script for new error handling

This commit is contained in:
Fredrik Eriksson 2022-02-26 08:48:22 +01:00
parent 3311e2099a
commit 48a80d7e44
Signed by: feffe
GPG Key ID: 97FD478B50475788
2 changed files with 14 additions and 6 deletions

View File

@ -71,14 +71,18 @@ def main():
parts=[]
while domain:
res = client.getSubdomains(user, pwd, domain)
if 'UNKNOWN_ERROR' not in res:
try:
res = client.getSubdomains(user, pwd, domain)
except xmlrpc.client.Fault as err:
if err.faultCode != 404:
raise err
else:
break
part, domain = domain.split('.', maxsplit=1)
parts.append(part)
subdomain = '_acme-challenge.{}'.format('.'.join(parts))
if 'UNKNOWN_ERROR' in res:
if not res:
print("Failed to find domain in loopiadns")
return 1

View File

@ -58,14 +58,18 @@ def main():
parts=[]
while domain:
res = client.getSubdomains(user, pwd, domain)
if 'UNKNOWN_ERROR' not in res:
try:
res = client.getSubdomains(user, pwd, domain)
except xmlrpc.client.Fault as err:
if err.faultCode != 404:
raise err
else:
break
part, domain = domain.split('.', maxsplit=1)
parts.append(part)
subdomain = '_acme-challenge.{}'.format('.'.join(parts))
if 'UNKNOWN_ERROR' in res:
if not res:
print("Failed to find domain in loopiadns")
return 1