NetworkManager on liveCD doesn't use ifcfg files, so we don't
see any devices to be configured in anaconda (which is OK),
but we still offer hostname choice, so honor it.
---
pyanaconda/network.py | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index ae06f1e..d12d8ac 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -446,6 +446,22 @@ class Network:
else:
self.netdevices[device].set(('GATEWAY', gw))
+ @property
+ def gateway(self):
+ """GATEWAY - last device in list wins"""
+ gw = ""
+ for dev in self.netdevices.values():
+ gw = dev.get('GATEWAY')
+ return gw
+
+ @property
+ def ipv6_defaultgw(self):
+ """IPV6_DEFAULTGW - last device in list wins"""
+ gw = ""
+ for dev in self.netdevices.values():
+ gw = dev.get('IPV6_DEFAULTGW')
+ return gw
+
def lookupHostname(self):
# can't look things up if they don't exist!
if not self.hostname or self.hostname == "localhost.localdomain":
@@ -630,9 +646,6 @@ class Network:
def copyConfigToPath(self, instPath='):
- if len(self.netdevices) == 0:
- return
-
# /etc/sysconfig/network-scripts/ifcfg-DEVICE
# /etc/sysconfig/network-scripts/keys-DEVICE
# /etc/dhcp/dhclient-DEVICE.conf
@@ -674,9 +687,6 @@ class Network:
devices = self.netdevices.values()
- if len(devices) == 0:
- return
-
# /etc/sysconfig/network-scripts/ifcfg-*
# /etc/sysconfig/network-scripts/keys-*
for dev in devices:
@@ -707,11 +717,11 @@ class Network:
else:
f.write("localhost.localdomain
")
- if dev.get('GATEWAY'):
- f.write("GATEWAY=%s
" % (dev.get('GATEWAY'),))
+ if self.gateway:
+ f.write("GATEWAY=%s
" % self.gateway)
- if dev.get('IPV6_DEFAULTGW'):
- f.write("IPV6_DEFAULTGW=%s
" % (dev.get('IPV6_DEFAULTGW'),))
+ if self.ipv6_defaultgw:
+ f.write("IPV6_DEFAULTGW=%s
" % self.ipv6_defaultgw)