manage multiple domains
This commit is contained in:
parent
8c1ae5abdd
commit
cd1def40e1
|
@ -94,37 +94,33 @@ def main(force_update, verbosity):
|
||||||
if verbosity:
|
if verbosity:
|
||||||
print("verbosity turned on - not implemented by now")
|
print("verbosity turned on - not implemented by now")
|
||||||
|
|
||||||
|
for key, value in config.dnsentries.items():
|
||||||
#get zone ID from Account
|
config.domain = key
|
||||||
uuid = get_uuid()
|
config.subdomains = value
|
||||||
|
|
||||||
|
#get zone ID from Account
|
||||||
|
uuid = get_uuid()
|
||||||
|
|
||||||
#compare dynIP and DNS IP
|
#compare dynIP and DNS IP
|
||||||
dynIP = get_dynip(config.ifconfig)
|
dynIP = get_dynip(config.ifconfig)
|
||||||
dnsIP = get_dnsip(uuid)
|
dnsIP = get_dnsip(uuid)
|
||||||
|
|
||||||
if force_update:
|
if force_update:
|
||||||
print("Going to update/create the DNS Records for the subdomains")
|
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:
|
for sub in config.subdomains:
|
||||||
update_records(uuid, dynIP, sub)
|
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__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-v', '--verbose', help="increase output verbosity", action="store_true")
|
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")
|
parser.add_argument('-f', '--force', help="force an update/create", action="store_true")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
main(args.force, args.verbose)
|
main(args.force, args.verbose)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue