Commit 0697f7e8 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Version 2012-11-22 11:04

M  src/hostinfo/ifconfig.py
parent a9bc4ca3
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment