X-Git-Url: http://git.onelab.eu/?p=myplc.git;a=blobdiff_plain;f=bin%2Fdns-config;h=11a531883de8c5b8c668bc763b6915a8229a1af5;hp=fbf294bf34efaa80b330d258581bac0ea1e9d562;hb=44e5503e7c13391778c11ebd2f3086fa985b1a2f;hpb=0a44b2253322be666bf1355b50228ef31175b841 diff --git a/bin/dns-config b/bin/dns-config index fbf294b..11a5318 100755 --- a/bin/dns-config +++ b/bin/dns-config @@ -21,7 +21,7 @@ def writepid(prog): pid = pidfile.readline().strip() pidfile.close() if os.path.isdir("/proc/" + pid): - print "Error: Another copy of %s is still running (%s)" % (prog, pid) + print("Error: Another copy of %s is still running (%s)" % (prog, pid)) sys.exit(1) except IOError: pass @@ -41,8 +41,8 @@ def main(): variables = cfg.variables() (category, variablelist) = variables['plc_dns'] - plc_dns = dict(zip(variablelist.keys(), - [variable['value'] for variable in variablelist.values()])) + plc_dns = dict(list(zip(list(variablelist.keys()), + [variable['value'] for variable in list(variablelist.values())]))) if plc_dns['enabled'] != "true": return 0 @@ -55,7 +55,7 @@ def main(): nodes[node['node_id']] = node interface_ids = set() - for node in nodes.values(): + for node in list(nodes.values()): interface_ids.update(node['interface_ids']) for interface in GetInterfaces(list(interface_ids)): @@ -67,7 +67,7 @@ def main(): else: hostname = nodes[interface['node_id']]['hostname'] - if hosts.has_key(interface['ip']): + if interface['ip'] in hosts: if hostname not in hosts[interface['ip']]: hosts[interface['ip']].append(hostname) else: @@ -76,7 +76,7 @@ def main(): # Write /etc/plc_hosts plc_hosts = open("/etc/plc_hosts", "w") plc_hosts.write("# DO NOT EDIT; File is writen and removed by automatic scripts\n") - for ip, hostnames in hosts.iteritems(): + for ip, hostnames in hosts.items(): plc_hosts.write(ip + "\t" + " ".join(hostnames) + "\n") plc_hosts.close()