Commit bb065c1b authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Version 2012-12-08 13:59

M  src/hostinfo/ifconfig.py
parent 0697f7e8
......@@ -33,30 +33,35 @@ def generate(tree, host):
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
(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])
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:
nameservers.append(n)
pass
config += "%sIPADDR%s=%s\n" % (pre, index, ip.address[0])
if not s:
config += "%sNETMASK%s=255.255.255.255\n" % (pre, index)
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')
else:
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
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