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

[PATCH f16 beta NTH?] Default to an active network device after reboot on Fedora (ONBOOT) (#498207)



I'd like to have this in F16, proposing the bug as F16 Beta NTH.

If no device was activated during install (e.g. DVD install),
set ONBOOT=yes for first wired device having link found.
(Which means the device will be brought up after system boot).
---
 pyanaconda/__init__.py   |    2 ++
 pyanaconda/network.py    |   12 ++++++++++++
 pyanaconda/yuminstall.py |    2 ++
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py
index 5ba37a3..04a618d 100644
--- a/pyanaconda/__init__.py
+++ b/pyanaconda/__init__.py
@@ -290,6 +290,8 @@ class Anaconda(object):
         self.instLanguage.write(self.rootPath)
 
         self.timezone.write(self.rootPath)
+        if not self.ksdata:
+            self.network.setOnbootDefault(self.instClass.id)
         self.network.write()
         self.network.copyConfigToPath(instPath=self.rootPath)
         self.network.disableNMForStorageDevices(self,
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 5f3a225..5e4cc79 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -759,6 +759,18 @@ class Network:
                     log.warning("disableNMForStorageDevices: %s file not found" %
                                 device.path)
 
+    def setOnbootDefault(self, inst_class_id=None):
+        if inst_class_id == "fedora":
+            # devices activated during installation have ONBOOT=yes
+            if hasActiveNetDev():
+                return
+
+            for devName, dev in self.netdevices.items():
+                if (not isys.isWirelessDevice(devName) and
+                    isys.getLinkStatus(devName)):
+                    dev.set(('ONBOOT', 'yes'))
+                    break
+
     def write(self):
         ifcfglog.debug("Network.write() called")
 
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index 26c3c46..66d84b8 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -1602,6 +1602,8 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
             if os.access("/etc/modprobe.d/anaconda.conf", os.R_OK):
                 shutil.copyfile("/etc/modprobe.d/anaconda.conf", 
                                 anaconda.rootPath + "/etc/modprobe.d/anaconda.conf")
+            if not anaconda.ksdata:
+                anaconda.network.setOnbootDefault(anaconda.instClass.id)
             anaconda.network.write()
             anaconda.network.copyConfigToPath(instPath=anaconda.rootPath)
             anaconda.storage.write(anaconda.rootPath)
-- 
1.7.4


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