diff --git a/update-record.py b/update-record.py index 8de2d04..519056a 100755 --- a/update-record.py +++ b/update-record.py @@ -46,7 +46,7 @@ if (mode == "delete" or mode == "update"): recordFound = False for r in records: - if (r['name'] == args.domain and r['type'] == record_type): + if (r['name'] == domain and r['type'] == record_type): recordFound = True if (verbose): print('entry:', r) @@ -54,14 +54,14 @@ # delete entry if (mode == "delete"): # if content is not none: delete only entry with given content. - if (args.content != None and r['content'] != content): + if (content != None and r['content'] != content): continue ret = errorCheck(api_client.call_api(api_method='nameserver.deleteRecord', method_params={'id': r['id']})) if (verbose): print('delete:', ret) # update entry - elif (args.update): + elif (mode == "update"): ret = errorCheck(api_client.call_api(api_method='nameserver.updateRecord', method_params={'id': r['id'], 'type': record_type, 'content': content, 'ttl': ttl})) if (verbose): print('update:', ret)