think i need a small fix for this. it's not creating records it ought to.

This commit is contained in:
brent s. 2020-05-10 08:32:49 -04:00
parent b8592686e4
commit b638e58dc8
Signed by: bts
GPG Key ID: 8C004C2F93481F6B

View File

@ -135,7 +135,8 @@ class Updater(object):
logger.error('Record {0} ({1}) is too long: {2}'.format(record, t, e)) logger.error('Record {0} ({1}) is too long: {2}'.format(record, t, e))
continue continue
except dns.resolver.NoAnswer as e: except dns.resolver.NoAnswer as e:
logger.error('Record {0} ({1}) exists but has no content: {2}'.format(record, t, e)) # This is a debug instead of an error because that record type may not exist.
logger.debug('Record {0} ({1}) exists but has no content: {2}'.format(record, t, e))
continue continue
except dns.resolver.NoNameservers as e: except dns.resolver.NoNameservers as e:
logger.error(('Could not failover to a non-broken resolver when resolving {0} ({1}): ' logger.error(('Could not failover to a non-broken resolver when resolving {0} ({1}): '
@ -238,7 +239,7 @@ class Updater(object):
r_exists = False r_exists = False
if r_exists: if r_exists:
# Do nothing. # Do nothing.
e = 'Skipping adding {0} for {1}; already exists in API'.format(ip, fqdn) e = 'Skipping adding {0} for {1}; already exists in API and is correct'.format(ip, fqdn)
logger.info(e) logger.info(e)
if is_tty: if is_tty:
print(e) print(e)
@ -268,7 +269,7 @@ class Updater(object):
'target': ip, 'target': ip,
'ttl_sec': 300} 'ttl_sec': 300}
create_url = '{0}/domains/{1}/records'.format(self.api_base, d_id) create_url = '{0}/domains/{1}/records'.format(self.api_base, d_id)
create_r = self.session.put(create_url, create_r = self.session.post(create_url,
json = record) json = record)
if not create_r.ok: if not create_r.ok:
e = 'Could not create record {0} ({1}); skipping'.format(fqdn, t) e = 'Could not create record {0} ({1}); skipping'.format(fqdn, t)