manage multiple domains

This commit is contained in:
Gitouche 2021-01-09 16:02:14 +01:00
parent 8c1ae5abdd
commit cd1def40e1

View file

@ -94,37 +94,33 @@ def main(force_update, verbosity):
if verbosity:
print("verbosity turned on - not implemented by now")
#get zone ID from Account
uuid = get_uuid()
for key, value in config.dnsentries.items():
config.domain = key
config.subdomains = value
#get zone ID from Account
uuid = get_uuid()
#compare dynIP and DNS IP
dynIP = get_dynip(config.ifconfig)
dnsIP = get_dnsip(uuid)
#compare dynIP and DNS IP
dynIP = get_dynip(config.ifconfig)
dnsIP = get_dnsip(uuid)
if force_update:
print("Going to update/create the DNS Records for the subdomains")
for sub in config.subdomains:
update_records(uuid, dynIP, sub)
else:
if dynIP == dnsIP:
print("IP Address Match - no further action")
else:
print("IP Address Mismatch - going to update the DNS Records for the subdomains with new IP", dynIP)
if force_update:
print("Going to update/create the DNS Records for the subdomains")
for sub in config.subdomains:
update_records(uuid, dynIP, sub)
else:
if dynIP == dnsIP:
print("IP Address Match - no further action")
else:
print("IP Address Mismatch - going to update the DNS Records for the subdomains with new IP", dynIP)
for sub in config.subdomains:
update_records(uuid, dynIP, sub)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', help="increase output verbosity", action="store_true")
parser.add_argument('-f', '--force', help="force an update/create", action="store_true")
args = parser.parse_args()
main(args.force, args.verbose)