[PATCH master] Honor selected hostname on Live CD (#638634)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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\n")
 
-        if dev.get('GATEWAY'):
-            f.write("GATEWAY=%s\n" % (dev.get('GATEWAY'),))
+        if self.gateway:
+            f.write("GATEWAY=%s\n" % self.gateway)
 
-        if dev.get('IPV6_DEFAULTGW'):
-            f.write("IPV6_DEFAULTGW=%s\n" % (dev.get('IPV6_DEFAULTGW'),))
+        if self.ipv6_defaultgw:
+            f.write("IPV6_DEFAULTGW=%s\n" % self.ipv6_defaultgw)
 
         f.close()
         shutil.move(newnetwork, networkConfFile)
-- 
1.7.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux