Merge pull request #313 from tmuncks/tolerate-pdns-3-api

Tolerate pdns 3.x API deficiencies
This commit is contained in:
Khanh Ngo 2018-08-01 21:21:00 +07:00 committed by GitHub
commit 501b817808
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -486,6 +486,10 @@ class Account(db.Model):
"""
Convert account_name to account_id
"""
# Skip actual database lookup for empty queries
if account_name is None or account_name == "":
return None
account = Account.query.filter(Account.name == account_name).first()
if account is None:
return None
@ -759,7 +763,11 @@ class Domain(db.Model):
# update/add new domain
for data in jdata:
if 'account' in data:
account_id = Account().get_id_by_name(data['account'])
else:
logging.debug("No 'account' data found in API result - Unsupported PowerDNS version?")
account_id = None
d = dict_db_domain.get(data['name'].rstrip('.'), None)
changed = False
if d: