|
|
|
@ -45,7 +45,13 @@ def get_record_id(zone,subdomain):
|
|
|
|
|
def set_record(zone, subdomain, ip):
|
|
|
|
|
id=get_record_id(zone,subdomain)
|
|
|
|
|
|
|
|
|
|
result = client.put('/domain/zone/joefix.it/record/' + str(id), subDomain=subdomain, target=ip, ttl=60)
|
|
|
|
|
result = client.put('/domain/zone/' + zone + '/record/' + str(id), subDomain=subdomain, target=ip, ttl=60)
|
|
|
|
|
|
|
|
|
|
if result != None:
|
|
|
|
|
my_logger.critical('couldn\'t change record')
|
|
|
|
|
exit()
|
|
|
|
|
|
|
|
|
|
result = client.post('/domain/zone/' + zone + '/refresh')
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -68,6 +74,8 @@ if len(sys.argv) > 2:
|
|
|
|
|
|
|
|
|
|
if (set_record (sys.argv[1], sys.argv[2], currentIP) == None ):
|
|
|
|
|
my_logger.debug('IP of ' + sys.argv[2] + '.' + sys.argv[1] + ' successfully changed to ' + currentIP)
|
|
|
|
|
else:
|
|
|
|
|
my_logger.critical('Couldn\'t change IP')
|
|
|
|
|
|
|
|
|
|
with open(TMPFILE, 'w') as file:
|
|
|
|
|
file.write(currentIP)
|
|
|
|
|