diff --git a/src/gandi-live-dns.py b/src/gandi-live-dns.py index e5b34a0..0f710e6 100755 --- a/src/gandi-live-dns.py +++ b/src/gandi-live-dns.py @@ -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) - - - - - -