summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrent s <bts@square-r00t.net>2020-05-10 08:48:08 -0400
committerbrent s <bts@square-r00t.net>2020-05-10 08:48:08 -0400
commitb2848970c327288ed61415b18f1cb30cf766a7a2 (patch)
treee330000eecff13ec019ed961097d45e1bb2d06b7
parentb638e58dc84bef5149ea463aaa03e9017028a542 (diff)
downloadOpTools-b2848970c327288ed61415b18f1cb30cf766a7a2.tar.xz
still fiddling
-rwxr-xr-xnet/dns/linode/ddns.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/net/dns/linode/ddns.py b/net/dns/linode/ddns.py
index afa60ea..5b15f90 100755
--- a/net/dns/linode/ddns.py
+++ b/net/dns/linode/ddns.py
@@ -252,9 +252,9 @@ class Updater(object):
# update.
logger.debug('Record {0} ({1}) exists but does not contain {2}; replacing'.format(fqdn, t, ip))
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))
- del_r = self.session.delete(records_url)
+ del_r = self.session.delete(del_url)
if not del_r.ok:
e = 'Could not delete record ID {0} for {1} ({2}); skipping'.format(r_id, fqdn, t)
if is_tty:
@@ -264,19 +264,18 @@ class Updater(object):
else:
# Create the record.
logger.debug('Record {0} ({1}) does not exist; creating'.format(fqdn, ip))
- record = {'name': s,
- 'type': t,
- 'target': ip,
- 'ttl_sec': 300}
- create_url = '{0}/domains/{1}/records'.format(self.api_base, d_id)
- create_r = self.session.post(create_url,
- json = record)
- if not create_r.ok:
- e = 'Could not create record {0} ({1}); skipping'.format(fqdn, t)
- if is_tty:
- warnings.warn(e)
- logger.warning(e)
- continue
+ record = {'name': s,
+ 'type': t,
+ 'target': ip,
+ 'ttl_sec': 300}
+ create_r = self.session.post(records_url,
+ json = record)
+ if not create_r.ok:
+ e = 'Could not create record {0} ({1}); skipping'.format(fqdn, t)
+ if is_tty:
+ warnings.warn(e)
+ logger.warning(e)
+ continue
return()