still fiddling
This commit is contained in:
parent
b638e58dc8
commit
b2848970c3
@ -252,9 +252,9 @@ class Updater(object):
|
|||||||
# update.
|
# update.
|
||||||
logger.debug('Record {0} ({1}) exists but does not contain {2}; replacing'.format(fqdn, t, ip))
|
logger.debug('Record {0} ({1}) exists but does not contain {2}; replacing'.format(fqdn, t, ip))
|
||||||
for r_id in r_ids:
|
for r_id in r_ids:
|
||||||
del_url = '{0}/domains/{1}/records/{1}'.format(self.api_base, d_id, r_id)
|
del_url = '{0}/{1}'.format(records_url, r_id)
|
||||||
logger.debug(('Deleting record ID {0} for {1} ({2})').format(r_id, fqdn, t))
|
logger.debug(('Deleting record ID {0} for {1} ({2})').format(r_id, fqdn, t))
|
||||||
del_r = self.session.delete(records_url)
|
del_r = self.session.delete(del_url)
|
||||||
if not del_r.ok:
|
if not del_r.ok:
|
||||||
e = 'Could not delete record ID {0} for {1} ({2}); skipping'.format(r_id, fqdn, t)
|
e = 'Could not delete record ID {0} for {1} ({2}); skipping'.format(r_id, fqdn, t)
|
||||||
if is_tty:
|
if is_tty:
|
||||||
@ -264,19 +264,18 @@ class Updater(object):
|
|||||||
else:
|
else:
|
||||||
# Create the record.
|
# Create the record.
|
||||||
logger.debug('Record {0} ({1}) does not exist; creating'.format(fqdn, ip))
|
logger.debug('Record {0} ({1}) does not exist; creating'.format(fqdn, ip))
|
||||||
record = {'name': s,
|
record = {'name': s,
|
||||||
'type': t,
|
'type': t,
|
||||||
'target': ip,
|
'target': ip,
|
||||||
'ttl_sec': 300}
|
'ttl_sec': 300}
|
||||||
create_url = '{0}/domains/{1}/records'.format(self.api_base, d_id)
|
create_r = self.session.post(records_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)
|
if is_tty:
|
||||||
if is_tty:
|
warnings.warn(e)
|
||||||
warnings.warn(e)
|
logger.warning(e)
|
||||||
logger.warning(e)
|
continue
|
||||||
continue
|
|
||||||
return()
|
return()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user