diff options
author | Jeremy Katz <katzj@redhat.com> | 2002-05-09 21:46:09 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2002-05-09 21:46:09 +0000 |
commit | 7f591ac709c10e5e674e791ab11d31257e0ee124 (patch) | |
tree | 1a75c8cd6e9e5f92ce92fde951dc963bf95b5659 /network.py | |
parent | 344efbe832df0d9b7e013df23e01694cfafe0773 (diff) | |
download | anaconda-7f591ac709c10e5e674e791ab11d31257e0ee124.tar.gz anaconda-7f591ac709c10e5e674e791ab11d31257e0ee124.tar.xz anaconda-7f591ac709c10e5e674e791ab11d31257e0ee124.zip |
write out multiple network lines if needed
Diffstat (limited to 'network.py')
-rw-r--r-- | network.py | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/network.py b/network.py index 3372697ec..7f75da869 100644 --- a/network.py +++ b/network.py @@ -183,36 +183,32 @@ class Network: return (self.primaryNS, self.secondaryNS, self.ternaryNS) def writeKS(self, f): - # XXX - # - # Hopefully the first one is the right one to use. We ought to support - # multiple "network" lines - # - # This doesn't write out nodns, ever. - # devNames = self.netdevices.keys() devNames.sort() if len(devNames) == 0: return - - dev = self.netdevices[devNames[0]] - if dev.get('bootproto') == 'dhcp' or dev.get('ipaddr'): - f.write("network --device %s" % dev.get('device')) - if dev.get('bootproto') == 'dhcp': - f.write(" --bootproto dhcp") - else: - f.write(" --bootproto static --ip %s --netmask %s --gateway %s" % - (dev.get('ipaddr'), dev.get('netmask'), self.gateway)) - - if self.primaryNS: - f.write(" --nameserver %s" % self.primaryNS) - - if self.hostname and self.hostname != "localhost.localdomain": - f.write(" --hostname %s" % self.hostname) - - f.write("\n"); + for devName in devNames: + dev = self.netdevices[devName] + + if dev.get('bootproto') == 'dhcp' or dev.get('ipaddr'): + f.write("network --device %s" % dev.get('device')) + if dev.get('bootproto') == 'dhcp': + f.write(" --bootproto dhcp") + else: + f.write(" --bootproto static --ip %s --netmask %s --gateway %s" % + (dev.get('ipaddr'), dev.get('netmask'), self.gateway)) + + if dev.get('bootproto') != 'dhcp': + if self.primaryNS: + f.write(" --nameserver %s" % self.primaryNS) + + if (self.hostname and + self.hostname != "localhost.localdomain"): + f.write(" --hostname %s" % self.hostname) + + f.write("\n"); def write(self, instPath): # /etc/sysconfig/network-scripts/ifcfg-* |