From b11294a92519c73a2ba0b338daec1532af46f96c Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Wed, 24 Jan 2007 12:19:48 +0100 Subject: [PATCH] Version 2007-01-24 12:19 M src/hostinfo/dhcpd.py M src/hostinfo/ifconfig.py M src/hostinfo/parser.py M src/hostinfo/yp.py --- src/hostinfo/dhcpd.py | 3 ++- src/hostinfo/ifconfig.py | 12 ++++++++---- src/hostinfo/parser.py | 8 ++++---- src/hostinfo/yp.py | 8 ++++++++ 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/hostinfo/dhcpd.py b/src/hostinfo/dhcpd.py index 6b9b087..000378c 100755 --- a/src/hostinfo/dhcpd.py +++ b/src/hostinfo/dhcpd.py @@ -7,8 +7,9 @@ def conf(tree, dhcphost): # emit = False for ds in tree._host_._interface_._dhcpserver_: - if ds.name[0:] == dhcphost: + if dhcphost in ds.name[0::1]: # Given host is a nameserver + dhcphost = ds.name[0:] emit = True if not emit: diff --git a/src/hostinfo/ifconfig.py b/src/hostinfo/ifconfig.py index 8e68415..04732dc 100755 --- a/src/hostinfo/ifconfig.py +++ b/src/hostinfo/ifconfig.py @@ -13,10 +13,12 @@ def generate(tree, host): config += "HWADDR=%s\n" % i.ethernet[0].upper() config += "ONBOOT=yes\n" config += "TYPE=Ethernet\n" - if not i._dhcpserver_: - config += "BOOTPROTO=dhcp\n" - else: - s = subnet(tree, i.ip[0]) + if i._dhcpserver_ or i._static_: + if i._dhcpserver_: + s = subnet(tree, i.ip[0]) + else: + s = i._static_[0] + config += "BOOTPROTO=none\n" config += "IPADDR=%s\n" % i.ip[0] if s and s.gateway[0] and s.gateway[0] != i.ip[0]: @@ -27,6 +29,8 @@ def generate(tree, host): config += "NETWORK=%s\n" % s.network[0] if s and s.broadcast[0]: config += "BROADCAST=%s\n" % s.broadcast[0] + else: + config += "BOOTPROTO=dhcp\n" result.append(("ifcfg-%s" % d, config)) return result diff --git a/src/hostinfo/parser.py b/src/hostinfo/parser.py index 46e0ab8..8be620b 100755 --- a/src/hostinfo/parser.py +++ b/src/hostinfo/parser.py @@ -238,7 +238,7 @@ class AttributeAccessor: # Return first declaration within range # attr[start:stop] node = self._node - i= 0 + i = 0 while node and i < last: if i >= first: try: @@ -270,9 +270,9 @@ class AttributeAccessor: if index.step == None: # Return first declaration within range # attr[start:stop] - (next,last,stride) = index.indices(sys.maxint) + (next,last,stride) = index.indices(10000) node = self._node - i= 0 + i = 0 while node and i < last: if i >= next: try: @@ -285,7 +285,7 @@ class AttributeAccessor: else: # Return all declaration within range result = [] - (next,last,stride) = index.indices(sys.maxint) + (next,last,stride) = index.indices(10000) node = self._node i= 0 while node and i < last: diff --git a/src/hostinfo/yp.py b/src/hostinfo/yp.py index db5fcae..3761cf5 100755 --- a/src/hostinfo/yp.py +++ b/src/hostinfo/yp.py @@ -60,6 +60,14 @@ def netgroup(tree): except: netgroup[g.name[0:]] = [ entry ] + 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 ] + result = "" keys = netgroup.keys() keys.sort() -- GitLab