diff --git a/src/hostinfo.py b/src/hostinfo.py index ba7b44caed77fa842f001363834084180f4905a0..e25bb9c5bff267289fd3e7b97ddeeb8aa41c313b 100755 --- a/src/hostinfo.py +++ b/src/hostinfo.py @@ -99,21 +99,25 @@ attr_weight = { def host_order(a,b): def at_top(n): # Place hosts without ethernet or ip address at top - for i in n._interface_: - if i.ip[0]: - return False - if i.ethernet[0]: + for i1 in n._interface_: + if i1.ethernet[0]: return False + for i2 in i1._ip_: + if i2.address[0]: + return False + pass pass return True def at_bottom(n): # Place hosts with ethernet but without ip address at bottom result = False - for i in n._interface_: - if i.ip[0]: - return False - if i.ethernet[0]: + for i1 in n._interface_: + if i1.ethernet[0]: result = True + for i2 in i1._ip_: + if i2.address[0]: + return False + pass pass return result if (at_top(a) == at_top(b) and at_bottom(a) == at_bottom(b)): @@ -144,11 +148,13 @@ tag_weight = { None), ('interface', 'kickstart') : (1, None), - ('interface', 'alias') : (2, + ('interface', 'ip') : (2, + None), + ('interface', 'alias') : (3, None), - ('interface', 'dhcpserver') : (3, + ('interface', 'dhcpserver') : (4, None), - ('interface', 'nameserver') : (4, + ('interface', 'nameserver') : (5, None), ('automount', 'entry') : (1, lambda a,b: cmp(a.key[0],b.key[0])), @@ -294,9 +300,9 @@ if __name__ == '__main__': file["%s/ksinfo" % options.pxelinux] = ksinfo if options.pretty: - result = "<?xml version='1.0' encoding='iso8859-1'?>\n\n" + result = "<?xml version='1.0' encoding='utf-8'?>\n\n" result += tree._xml(attr_sort=attr_sort, tag_sort=tag_sort) - print result.encode("iso8859-1") + print result.encode("utf-8") if options.yp: for (f, c) in hostinfo.yp.generate(tree, options.yp_auto_domain): diff --git a/src/hostinfo/dhcpd.py b/src/hostinfo/dhcpd.py index 5c0726aba179daa57f04aabe5e43b2c530a411db..1768cf3ad8b853a68b9e2cf071ae97541228620a 100755 --- a/src/hostinfo/dhcpd.py +++ b/src/hostinfo/dhcpd.py @@ -47,7 +47,6 @@ class "AppleNBI-ppc" { """ % (dhcphost, dhcphost) def conf(tree, dhcphost, kickstart, next_server=None): - print next_server # # A. Get interfaces to serve # @@ -55,8 +54,10 @@ def conf(tree, dhcphost, kickstart, next_server=None): for ds in tree._host_._interface_._dhcpserver_: if dhcphost in ds.name[0::1]: # Host is dhcpserver for this interface - dhcpip = ds.ip[0:] + dhcpip = ds._parent._ip_[0].address[0] interface.append(ds._parent) + pass + pass if not interface: raise Exception("%s is not a dhcpserver" % dhcphost) @@ -73,27 +74,29 @@ def conf(tree, dhcphost, kickstart, next_server=None): for i in interface: address = [] vlan = [] - if i.ip[0]: - # Main address - address.append(i.ip[0]) for ip in i._ip_: if ip.alias[0] and ip.address[0]: # Alias addresses address.append(ip.address[0]) + pass elif ip.vlan[0] and ip.address[0]: vlan.append(ip.address[0]) - + pass + elif ip.address[0]: + address.append(ip.address[0]) + pass + pass result += emit_network(tree, dhcphost, address, kickstart, i.ethernet[0], next_server=next_server) for v in vlan: result += emit_network(tree, dhcphost, [ v ], kickstart, None, next_server=next_server) - + pass + pass return result def emit_network(tree, dhcphost, addr, kickstart, ethernet=None, next_server=None): - print next_server result = "" network = {} for n in tree._subnet_: @@ -120,7 +123,6 @@ def emit_network(tree, dhcphost, addr, kickstart, ethernet=None, def emit_subnet(tree, n, dhcphost, kickstart, next_server=None): result = "" - print next_server,dhcphost if next_server == None: next_server = dhcphost pass @@ -128,32 +130,46 @@ def emit_subnet(tree, n, dhcphost, kickstart, next_server=None): subnet = aton(n.network[0]) & netmask static = {} dynamic = {} - - for i in tree._host_._interface_: + never = [] + for ip in tree._host_._interface_._ip_: # Find all hosts that belong to this network - if i.ip[0]: - net = aton(i.ip[0]) & netmask + if ip.address[0]: + net = aton(ip.address[0]) & netmask if net == subnet: - if i.dynamic[0] == dhcphost: + if ip.dynamic[0] == dhcphost: # Dynamic address served by this host - dynamic[aton(i.ip[0])] = i + dynamic[aton(ip.address[0])] = ip + pass else: - static[i.name[0:]] = i - + static[ip.name[0:]] = ip + pass + pass + pass + if ip.never[0]: + net = aton(ip.never[0]) & netmask + if net == subnet: + never.append(ip.ethernet[0:]) + pass + pass + pass + result += "subnet %s netmask %s {\n" % (n.network[0], n.netmask[0]) result += " option subnet-mask %s;\n" % n.netmask[0] if n.broadcast[0]: result += " option broadcast-address %s;\n" % n.broadcast[0] + pass if n.gateway[0]: result += " option routers %s;\n" % n.gateway[0] + pass if n.domain[0]: result += " option domain-name \"%s\";\n" % n.domain[0] + pass if n.name_servers[0]: - result += " option domain-name-servers %s;\n" % ( - n.name_servers[0]) + result += " option domain-name-servers %s;\n" % n.name_servers[0] + pass if n.ntp_servers[0]: result += " option ntp-servers %s;\n" % (n.ntp_servers[0]) - + pass # # Emit dynamic hosts # @@ -166,13 +182,18 @@ def emit_subnet(tree, n, dhcphost, kickstart, next_server=None): for d in dk: if d == max + 1: max = d + pass else: if min: result += " range %s %s;\n" % (ntoa(min), ntoa(max)) + pass min = d max = d + pass + pass if min: result += " range %s %s;\n" % (ntoa(min), ntoa(max)) + pass result += " get-lease-hostnames true;\n" result += " use-host-decl-names on;\n" @@ -186,17 +207,17 @@ def emit_subnet(tree, n, dhcphost, kickstart, next_server=None): sk = static.keys() sk.sort() for i in [static[x] for x in sk]: - ether = i.ethernet[0] - ip = i.ip[0] + ether = i._parent.ethernet[0] + ip = i.address[0] if ether: result += " host %s.%s {\n"% (i.name[0:], n.domain[0]) result += " hardware ethernet %s;\n" % ether result += " fixed-address %s;\n" % ip result += " option host-name \"%s\";\n" % i.name[0:] - if i._kickstart_: + if i._parent._kickstart_: if not kickstart: raise Exception("--kickstart needed for %s" % i.name[0:]) - kf = i._kickstart_[0].file[0] + kf = i._parent._kickstart_[0].file[0] result += " server-name \"%s\";\n" % dhcphost result += " next-server %s;\n" % next_server result += " if substring(option vendor-class-identifier, " @@ -206,11 +227,20 @@ def emit_subnet(tree, n, dhcphost, kickstart, next_server=None): result += " } else {\n" result += " filename \"%s/%s\";\n" % (kickstart, kf) result += " }\n" + pass for d in i._dhcp_: result += " %s\n" % d.value[0] + pass result += " }\n" + pass + pass + for e in never: + result += " host never_%s {\n" % e.replace(':', '') + result += " hardware ethernet %s;\n" % e + result += " ignore booting;\n" + result += " }\n" + pass - result += " }\n" result += "}\n" diff --git a/src/hostinfo/ifconfig.py b/src/hostinfo/ifconfig.py index 6b94d0d08b45a9945b2c7a0543ebf90cd5186a5f..bb1811d0524dee96293af6876cb70d55157f5889 100755 --- a/src/hostinfo/ifconfig.py +++ b/src/hostinfo/ifconfig.py @@ -3,96 +3,199 @@ import os import re def generate(tree, host): + result = [] + for h in filter(lambda h: h.name[0] == host, tree._host_): + for i, d in map(lambda i: (i, device(i.ethernet[0])), + filter(lambda i: i.ethernet[0], h._interface_)): + static = True + if not i._dhcpserver_ and not i._static_: + for ip in i._ip_: + if ip.address[0] and not (ip.alias[0] or ip.vlan[0]): + static = False + pass + pass + pass + + config = "DEVICE=%s\n" % d + config += "HWADDR=%s\n" % i.ethernet[0].upper() + config += "ONBOOT=yes\n" + config += "TYPE=Ethernet\n" + pre = "" + index = "" + if not static: + config += "BOOTPROTO=dhcp\n" + pre= "# " + pass + else: + config += "BOOTPROTO=none\n" + pass + nameservers = [] + for s, ip in map(lambda ip: (subnet(tree, ip.address[0]), ip), + filter(lambda ip: (ip.address[0] and + subnet(tree, ip.address[0]) and + (static or + (not ip.vlan[0] and + ip.alias[0]))), + i._ip_)): + config += "%sIPADDR%s=%s\n" % (pre, index, ip.address[0]) + config += "%sGATEWAY%s=%s\n" % (pre, index, s.gateway[0]) + config += "%sNETMASK%s=%s\n" % (pre, index, s.netmask[0]) + config += "%sNETWORK%s=%s\n" % (pre, index, s.network[0]) + config += "%sBROADCAST%s=%s\n" % (pre, index, s.broadcast[0]) + for n in re.split("[, ]+", s.name_servers[0]): + # Domain nameservers + if not n in nameservers: + nameservers.append(n) + pass + pass + for n in i._nameserver_: + if n.domain[0] == s.domain[0]: + if not '127.0.0.1' in nameservers: + # Insert own address first in nameserver list + nameservers.insert(0, '127.0.0.1') + pass + pass + pass + index = int("0%s" % index)+1 + pass + if i.defroute[0]: + config += "DEFROUTE=%s\n" % i.defroute[0] + pass + if static: + # Nameservers + index = 0 + for n in nameservers: + index += 1 + config += "DNS%d=%s\n" % (index, n) + pass + pass + result.append(("ifcfg-%s" % d, config)) + pass + pass + return result + + +def generate_old(tree, host): result = [] for h in tree._host_: if h.name[0] == host: - for i in h._interface_: - d = device(i.ethernet[0]) - if d: - # Ordinary ethernet + for ip in h._interface_._ip_: + d = device(ip._parent.ethernet[0]) + if not d: + continue + + if ip.alias[0]: + # Alias + name = "%s:%s" % (d, ip.alias[0]) + config = "DEVICE=%s\n" % name + config += "HWADDR=%s\n" % ip._parent.ethernet[0].upper() + config += "ONPARENT=yes\n" + if not ip._parent._dhcpserver_: + config += "BOOTPROTO=dhcp\n" + pass + else: + s = subnet(tree, ip.address[0]) + config += "IPADDR=%s\n" % ip.address[0] + if s and s.netmask[0]: + config += "NETMASK=%s\n" % s.netmask[0] + pass + if s and s.network[0]: + config += "NETWORK=%s\n" % s.network[0] + pass + if s and s.broadcast[0]: + config += "BROADCAST=%s\n" % s.broadcast[0] + pass + pass + result.append(("ifcfg-%s" % name , config)) + pass + elif ip.vlan[0]: + # VLAN + name = "%s.%s" % (d, ip.vlan[0]) + config = "DEVICE=%s\n" % name + config += "HWADDR=%s\n" % ip._parent.ethernet[0].upper() + config += "ONBOOT=yes\n" + config += "VLAN=yes\n" + if not ip._parent._dhcpserver_: + config += "BOOTPROTO=dhcp\n" + pass + else: + s = subnet(tree, ip.address[0]) + config += "IPADDR=%s\n" % ip.address[0] + if s and s.netmask[0]: + config += "NETMASK=%s\n" % s.netmask[0] + pass + if s and s.network[0]: + config += "NETWORK=%s\n" % s.network[0] + pass + if s and s.broadcast[0]: + config += "BROADCAST=%s\n" % s.broadcast[0] + pass + pass + result.append(("ifcfg-%s" % name , config)) + pass + elif ip.address[0]: + # Ordinary address config = "DEVICE=%s\n" % d - config += "HWADDR=%s\n" % i.ethernet[0].upper() + config += "HWADDR=%s\n" % ip._parent.ethernet[0].upper() config += "ONBOOT=yes\n" config += "TYPE=Ethernet\n" - if i._dhcpserver_ or i._static_: - if i._dhcpserver_: - s = subnet(tree, i.ip[0]) + if not ip._parent._dhcpserver_ and not ip._parent._static_: + config += "BOOTPROTO=dhcp\n" + pass + else: + if ip._parent._dhcpserver_: + s = subnet(tree, ip.address[0]) + pass else: - s = i._static_[0] + s = ip._parent._static_[0] + pass if s and s.name_servers[0]: - name_servers = re.split("[, ]+", s.name_servers[0]) + name_servers = re.split("[, ]+", + s.name_servers[0]) + pass else: name_servers = [] + pass if s: - for n in i._nameserver_: + for n in ip._parent._nameserver_: if n.domain[0] == s.domain[0]: - name_servers = [i.ip[0]] + name_servers - + name_servers.insert(0, ip.address[0]) + pass + pass + pass config += "BOOTPROTO=none\n" - config += "IPADDR=%s\n" % i.ip[0] - if s and s.gateway[0] and s.gateway[0] != i.ip[0]: + config += "IPADDR=%s\n" % ip.address[0] + if s and s.gateway[0] and s.gateway[0] != ip.address[0]: config += "GATEWAY=%s\n" % s.gateway[0] + pass if s and s.netmask[0]: config += "NETMASK=%s\n" % s.netmask[0] + pass if s and s.network[0]: config += "NETWORK=%s\n" % s.network[0] + pass if s and s.broadcast[0]: config += "BROADCAST=%s\n" % s.broadcast[0] + pass if s and name_servers: ni = 0 for n in name_servers: ni += 1 config += "DNS%d=%s\n" % (ni, n) + pass + pass if s and s.domain[0]: config += "DOMAIN=%s\n" % s.domain[0] - else: - config += "BOOTPROTO=dhcp\n" - if i.defroute[0]: - config += "DEFROUTE=%s\n" % i.defroute[0] - + pass + pass + if ip.defroute[0]: + config += "DEFROUTE=%s\n" % ip.defroute[0] + pass result.append(("ifcfg-%s" % d, config)) - - # Aliases and VLANs - for ip in i._ip_: - if ip.alias[0]: - name = "%s:%s" % (d, ip.alias[0]) - config = "DEVICE=%s\n" % name - config += "HWADDR=%s\n" % i.ethernet[0].upper() - config += "ONPARENT=yes\n" - if not i._dhcpserver_: - config += "BOOTPROTO=dhcp\n" - else: - s = subnet(tree, ip.address[0]) - config += "IPADDR=%s\n" % ip.address[0] - if s and s.netmask[0]: - config += "NETMASK=%s\n" % s.netmask[0] - if s and s.network[0]: - config += "NETWORK=%s\n" % s.network[0] - if s and s.broadcast[0]: - config += "BROADCAST=%s\n" % s.broadcast[0] - - result.append(("ifcfg-%s" % name , config)) - - elif ip.vlan[0]: - name = "%s.%s" % (d, ip.vlan[0]) - config = "DEVICE=%s\n" % name - config += "HWADDR=%s\n" % i.ethernet[0].upper() - config += "ONBOOT=yes\n" - config += "VLAN=yes\n" - if not i._dhcpserver_: - config += "BOOTPROTO=dhcp\n" - else: - s = subnet(tree, ip.address[0]) - config += "IPADDR=%s\n" % ip.address[0] - if s and s.netmask[0]: - config += "NETMASK=%s\n" % s.netmask[0] - if s and s.network[0]: - config += "NETWORK=%s\n" % s.network[0] - if s and s.broadcast[0]: - config += "BROADCAST=%s\n" % s.broadcast[0] - - result.append(("ifcfg-%s" % name , config)) - + pass + pass + pass + pass return result diff --git a/src/hostinfo/macosx_auto.py b/src/hostinfo/macosx_auto.py index 18d2efb697ef7ffc55b43141467fad4dbd16a956..40919428b50468d590ede35f51db465c16cc9034 100755 --- a/src/hostinfo/macosx_auto.py +++ b/src/hostinfo/macosx_auto.py @@ -1,5 +1,3 @@ -from hostinfo.util import fqn - def generate(tree): maps = {} for am in tree._host_._automount_: diff --git a/src/hostinfo/named.py b/src/hostinfo/named.py index f1377d961d0092bf5f0d4699dd0ca43e00182362..3515773afaac866ba29b7d9e7c7e7598db70ee28 100755 --- a/src/hostinfo/named.py +++ b/src/hostinfo/named.py @@ -11,17 +11,21 @@ def generate(tree, host): if ns.name[0:] == host: # Given host is a nameserver emit = True - + pass + pass + if not emit: raise Exception("%s is not a nameserver" % host) - + # # B. Read named header # for h in tree._named_header_: header = h.get_char() print header - + raise Exception("Is this ever used") + pass + # # C. Generate named.conf and named/* files # @@ -105,7 +109,8 @@ def header(tree, domain, origin=None): for ns in tree._host_._interface_._nameserver_: if ns.domain[0] == domain and ns.primary[0] == 'yes': - result += " IN NS %s\n" % fqn(tree, ns) + result += " IN NS %s\n" % ( + fqn(tree, ns._parent)) result += ";\n" return result @@ -120,15 +125,15 @@ def forward(tree, domain): for m in tree._host_._interface_._mailhost_: if m.domain[0] == domain.domain[0]: pri = int(m.priority[0] or 0) - result += "%-16sIN MX %d %s\n" % ("", pri ,fqn(tree, m)) + result += "%-16sIN MX %d %s\n" % ("", pri ,fqn(tree, m._parent)) result += ";\n" host = {} - for i in tree._host_._interface_: + for i in tree._host_._interface_._ip_: # Find all hosts that belong to this network for (n, m) in net: - if i.ip[0] and aton(i.ip[0]) & m == n: - host[i.name[1:]] = "A %s" % i.ip[0] + if i.address[0] and aton(i.address[0]) & m == n: + host[i.name[1:]] = "A %s" % i.address[0] for a in i._alias_: host[a.name[0]] = "CNAME %s" % i.name[1:] for s in i._srv_: @@ -162,16 +167,17 @@ def reverse(tree, net): host = {} m = aton(net.netmask[0]) n = aton(net.network[0]) - for i in tree._host_._interface_: + for i in tree._host_._interface_._ip_: # Find all hosts that belong to this network - if i.ip[0] and aton(i.ip[0]) & m == n: - addr = aton(i.ip[0]) & ~m + if i.address[0] and aton(i.address[0]) & m == n: + addr = aton(i.address[0]) & ~m host[addr] = "PTR %s" % fqn(tree, i) hk = host.keys() hk.sort() for h in hk: result += "%-16dIN %s\n" % (h, host[h]) + pass return result def reverse_local(tree, nameserver): @@ -191,7 +197,9 @@ def reverse_local(tree, nameserver): t._add(net) # Add localhost h = hostinfo.parser.Node("host", 0, { "name" : "localhost." }) - i = hostinfo.parser.Node("interface", 0, { "ip" : "127.0.0.1" }) + i = hostinfo.parser.Node("interface", 0) + ip = hostinfo.parser.Node("ip", 0, { "address" : "127.0.0.1" }) + i._add(ip) h._add(i) t._add(h) # Add nameserver (with extra domain entry) @@ -200,8 +208,14 @@ def reverse_local(tree, nameserver): h = copy.copy(ns._parent._parent) i = copy.copy(ns._parent) i._add(hostinfo.parser.Node("nameserver", attr={"primary":"yes"})) + for ip in ns._parent._ip_: + if not ip.alias[0] and not ip.vlan[0]: + i._add(copy.copy(ip)) + pass + pass h._add(i) t._add(h) break + pass return reverse(t, net) diff --git a/src/hostinfo/samba.py b/src/hostinfo/samba.py index 8acfdc03f2f6ffde80eecde3c8bb35d208c37df3..616f1ccdbe3a716ddbb8defa14cf929705ebd938 100755 --- a/src/hostinfo/samba.py +++ b/src/hostinfo/samba.py @@ -1,5 +1,3 @@ -from hostinfo.util import fqn - def msdfs(tree): result = [] result.extend(dfs(tree, 'home', '/home', 'auto.home')) diff --git a/src/hostinfo/util.py b/src/hostinfo/util.py index 3edec2f4428dd5cee31d482f5f91cd4e0d524358..458a075e77dc4a43d48ba5a858b9441cf92f90a0 100755 --- a/src/hostinfo/util.py +++ b/src/hostinfo/util.py @@ -12,13 +12,22 @@ def fqn(tree, host): name of host""" if host.name[0:].endswith('.'): return host.name[0:] - elif host.ip[0:]: + ip_addr = host.address[0] + if not ip_addr: + for ip in host._ip_: + if not ip.alias[0] and not ip.vlan[0]: + ip_addr = ip.address[0] + break + pass + pass + if ip_addr: for s in tree._subnet_: if (s.network[0] and - aton(host.ip[0:]) & aton(s.netmask[0]) == aton(s.network[0])): + aton(ip_addr) & aton(s.netmask[0]) == aton(s.network[0])): return "%s.%s." % (host.name[1:],s.domain[0]) + pass raise Exception("No subnet declaration for '%s' (%s)" % - (host.name[0:], host.ip[0:])) + (host.name[0:], ip_addr)) else: raise Exception("'%s' not FQN, but has no ip" % host.name[0:]) - + pass diff --git a/src/hostinfo/yp.py b/src/hostinfo/yp.py index 25ddf6c3f56a278e98b5b1161ae82a99fdcabb17..39c0d39d3ef331542d3316deee7b6b051c60dd10 100755 --- a/src/hostinfo/yp.py +++ b/src/hostinfo/yp.py @@ -10,25 +10,27 @@ def generate(tree, auto_domain): return result def ypsuffix(tree, ip): - try: - for n in tree._subnet_: + for n in tree._subnet_: + try: netmask = aton(n.netmask[0]) subnet = aton(n.network[0]) & netmask ipnet = aton(ip) & netmask if subnet == ipnet and n.yp_suffix[0:]: return n.yp_suffix[0:] - except: + pass + except: + pass pass return '' def hosts(tree): result = "" host = {} - for i in tree._host_._interface_: - if i.ip[0]: - host[i.ip[0]] = i.name[0:] + ypsuffix(tree, i.ip[0:]) + for i in tree._host_._interface_._ip_: + if i.address[0]: + host[i.address[0]] = i.name[0:] + ypsuffix(tree, i.address[0:]) for a in i._alias_: - host[i.ip[0]] += " %s" % a.name[0] + host[i.address[0]] += " %s" % a.name[0] key = host.keys() key.sort(by_ip) for k in key: @@ -41,10 +43,14 @@ def ethers(tree): for i in tree._host_._interface_: if i.ethernet[0]: host[i.ethernet[0]] = [ i.name[0:] ] - try: - host[i.ethernet[0]].append(fqn(tree, i)[0:-1]) - except: + for ip in i._ip_: + try: + host[i.ethernet[0]].append(fqn(tree, ip)[0:-1]) + except: + pass pass + pass + pass key = host.keys() key.sort(by_mac) for k in key: @@ -85,29 +91,38 @@ def netgroup(tree): for m in tree._netgroup_._member_: if m.netgroup[0]: entry = m.netgroup[0] + pass elif m.host[0]: entry = "(%s,,)" % m.host[0] + pass try: netgroup[m.name[1]].append(entry) + pass except: netgroup[m.name[1]] = [ entry ] - + pass + pass for g in tree._host_._interface_._netgroup_: - if g._parent.ip[0:]: - entry = "(%s,,)" % fqn(tree, g._parent)[0:-1] - try: - netgroup[g.name[0:]].append(entry) - except: - netgroup[g.name[0:]] = [ entry ] - + for ip in filter(lambda ip: not ip.alias[0] and not ip.vlan[0], + g._parent._ip_): + if not g.name[0:] in netgroup: + netgroup[g.name[0:]] = [ ] + pass + entry = "(%s,,)" % fqn(tree, ip)[0:-1] + netgroup[g.name[0:]].append(entry) + pass + pass for k in tree._host_._interface_._kickstart_: - if k._parent.ip[0:]: - entry = "(%s,,)" % fqn(tree, k._parent)[0:-1] - try: - netgroup["ks-%s" % k.file[0:]].append(entry) - except: - netgroup["ks-%s" % k.file[0:]] = [ entry ] - + for ip in filter(lambda ip: not ip.alias[0] and not ip.vlan[0], + k._parent._ip_): + entry = "(%s,,)" % fqn(tree, ip)[0:-1] + key = "ks-%s" % k.file[0:] + if not key in netgroup: + netgroup[key] = [] + pass + netgroup[key].append(entry) + pass + pass netgroup = adjust_netgroup(netgroup) result = "" keys = netgroup.keys() @@ -119,7 +134,9 @@ def netgroup(tree): entries.sort() for e in entries: result += " \\\n %s" % e + pass result += "\n" + pass return result def auto_map(tree, map_name, auto_domain):