From 0697f7e8b20d7e7ccfa55714739b6b2af8b11966 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Thu, 22 Nov 2012 11:04:11 +0100 Subject: [PATCH] Version 2012-11-22 11:04 M src/hostinfo/ifconfig.py --- src/hostinfo/ifconfig.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/hostinfo/ifconfig.py b/src/hostinfo/ifconfig.py index bb1811d..a6f0c2d 100755 --- a/src/hostinfo/ifconfig.py +++ b/src/hostinfo/ifconfig.py @@ -30,6 +30,7 @@ def generate(tree, host): config += "BOOTPROTO=none\n" pass nameservers = [] + search = [] 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 @@ -42,6 +43,9 @@ def generate(tree, host): 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]) + if ip.search[0]: + search.extend(ip.search[0].split()) + pass for n in re.split("[, ]+", s.name_servers[0]): # Domain nameservers if not n in nameservers: @@ -69,6 +73,9 @@ def generate(tree, host): config += "DNS%d=%s\n" % (index, n) pass pass + if search: + config += 'SEARCH="%s"\n' % (" ".join(search)) + pass result.append(("ifcfg-%s" % d, config)) pass pass -- GitLab