Changeset 10655 in genesis
- Timestamp:
- May 2, 2012, 10:49:02 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r10654 r10655 995 995 wleiden_cname[datadump['nodename']] = fqdn 996 996 997 wleiden_zone[fqdn].append( datadump['masterip'])997 wleiden_zone[fqdn].append((datadump['masterip'], True)) 998 998 999 999 # Hacking to get proper DHCP IPs and hostnames … … 1006 1006 dhcp_part = ".".join(ip.split('.')[0:3]) 1007 1007 if ip != datadump['masterip']: 1008 wleiden_zone["dhcp-gateway-%s.%s" % (iface_name, fqdn)].append( ip)1008 wleiden_zone["dhcp-gateway-%s.%s" % (iface_name, fqdn)].append((ip, False)) 1009 1009 for i in range(int(dhcp_start), int(dhcp_stop) + 1): 1010 wleiden_zone["dhcp-%s-%s.%s" % (i, iface_name, fqdn)].append( "%s.%s" % (dhcp_part, i))1010 wleiden_zone["dhcp-%s-%s.%s" % (i, iface_name, fqdn)].append(("%s.%s" % (dhcp_part, i), True)) 1011 1011 except (AttributeError, ValueError): 1012 1012 # First push it into a pool, to indentify the counter-part later on … … 1048 1048 if len(value) == 1: 1049 1049 (iface_name, fqdn, ip) = value[0] 1050 wleiden_zone["2unused-%s.%s" % (iface_name, fqdn)].append( ip)1050 wleiden_zone["2unused-%s.%s" % (iface_name, fqdn)].append((ip, True)) 1051 1051 1052 1052 # Device DNS names 1053 1053 if 'cnode' in fqdn.lower(): 1054 wleiden_zone["d-at-%s.%s" % (iface_name, fqdn)].append( showaddr(parseaddr(ip) + 1))1055 wleiden_cname["d-at-%s.%s" % (iface_name,sn(fqdn))] = "d-at-%s.%s" % ( iface_name, fqdn)1054 wleiden_zone["d-at-%s.%s" % (iface_name, fqdn)].append((showaddr(parseaddr(ip) + 1), False)) 1055 wleiden_cname["d-at-%s.%s" % (iface_name,sn(fqdn))] = "d-at-%s.%s" % ((iface_name, fqdn)) 1056 1056 1057 1057 elif len(value) == 2: 1058 1058 (a_iface_name, a_fqdn, a_ip) = value[0] 1059 1059 (b_iface_name, b_fqdn, b_ip) = value[1] 1060 wleiden_zone["2%s.%s" % (b_fqdn,a_fqdn)].append( a_ip)1061 wleiden_zone["2%s.%s" % (a_fqdn,b_fqdn)].append( b_ip)1060 wleiden_zone["2%s.%s" % (b_fqdn,a_fqdn)].append((a_ip, True)) 1061 wleiden_zone["2%s.%s" % (a_fqdn,b_fqdn)].append((b_ip, True)) 1062 1062 1063 1063 # Device DNS names 1064 1064 if 'cnode' in a_fqdn.lower() and 'cnode' in b_fqdn.lower(): 1065 wleiden_zone["d-at-%s.%s" % (a_iface_name, a_fqdn)].append( showaddr(parseaddr(a_ip) + 1))1066 wleiden_zone["d-at-%s.%s" % (b_iface_name, b_fqdn)].append( showaddr(parseaddr(b_ip) - 1))1065 wleiden_zone["d-at-%s.%s" % (a_iface_name, a_fqdn)].append((showaddr(parseaddr(a_ip) + 1), False)) 1066 wleiden_zone["d-at-%s.%s" % (b_iface_name, b_fqdn)].append((showaddr(parseaddr(b_ip) - 1), False)) 1067 1067 wleiden_cname["d-at-%s.%s" % (a_iface_name,sn(a_fqdn))] = "d-at-%s.%s" % (a_iface_name, a_fqdn) 1068 1068 wleiden_cname["d-at-%s.%s" % (b_iface_name,sn(b_fqdn))] = "d-at-%s.%s" % (b_iface_name, b_fqdn) … … 1075 1075 (iface_name, fqdn, ip) = item 1076 1076 pool_name = "2pool-" + showaddr(key).replace('.','-') + "-" + pool_to_name(fqdn,pool_members) 1077 wleiden_zone["%s.%s" % (pool_name, fqdn)].append( ip)1077 wleiden_zone["%s.%s" % (pool_name, fqdn)].append((ip, True)) 1078 1078 1079 1079 # Include static DNS entries … … 1096 1096 wleiden_raw[k] = item 1097 1097 elif valid_addr(item): 1098 wleiden_zone[k].append( item)1098 wleiden_zone[k].append((item, False)) 1099 1099 else: 1100 1100 wleiden_cname[k] = item … … 1127 1127 f.write(dns_header % details) 1128 1128 1129 for host,i ps in wleiden_zone.iteritems():1130 for ip in ips:1129 for host,items in wleiden_zone.iteritems(): 1130 for ip,reverse in items: 1131 1131 if valid_addr(ip): 1132 1132 f.write("%s.wleiden.net. IN A %s \n" % (host.lower(), ip)) … … 1145 1145 #XXX: Not effient, fix to proper data structure and do checks at other 1146 1146 # stages 1147 for host,ips in wleiden_zone.iteritems(): 1148 for ip in ips: 1147 for host,items in wleiden_zone.iteritems(): 1148 for ip,reverse in items: 1149 if not reverse: 1150 continue 1149 1151 if valid_addr(ip): 1150 if int(ip.split('.')[1]) == s: 1151 rev_ip = '.'.join(reversed(ip.split('.'))) 1152 f.write("%s.in-addr.arpa. IN PTR %s.wleiden.net.\n" % (rev_ip.lower(), host.lower())) 1152 if valid_addr(ip): 1153 if int(ip.split('.')[1]) == s: 1154 rev_ip = '.'.join(reversed(ip.split('.'))) 1155 f.write("%s.in-addr.arpa. IN PTR %s.wleiden.net.\n" % (rev_ip.lower(), host.lower())) 1153 1156 f.close() 1154 1157
Note:
See TracChangeset
for help on using the changeset viewer.