diff --git a/files/acme-auth-loopia.py b/files/acme-auth-loopia.py index 50a8957..21509bf 100755 --- a/files/acme-auth-loopia.py +++ b/files/acme-auth-loopia.py @@ -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 diff --git a/files/acme-cleanup-loopia.py b/files/acme-cleanup-loopia.py index 3836987..2549f82 100755 --- a/files/acme-cleanup-loopia.py +++ b/files/acme-cleanup-loopia.py @@ -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