[PATCH] When bringing up network in UI, update only ifcfg file of selected device (#507084)

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

 



The value of NM_CONTROLLED has to change from no to yes to trigger device
activation by updating of ifcfg file, so we need to update just the files of
devices selected by user (instead of all devices).  Otherwise, selection of
another device after previously failed selection doesn't work.
Also make writing out of ONBOOT in text mode consistent with gui.
---
 iw/netconfig_dialog.py  |    4 ++--
 network.py              |   14 +++++++++-----
 textw/netconfig_text.py |   10 +++++++++-
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/iw/netconfig_dialog.py b/iw/netconfig_dialog.py
index ea59613..beb671f 100644
--- a/iw/netconfig_dialog.py
+++ b/iw/netconfig_dialog.py
@@ -240,7 +240,7 @@ class NetworkConfigurator:
             w = gui.WaitWindow(_("Dynamic IP Address"),
                                _("Sending request for IP address information "
                                  "for %s") % (netdev.get('DEVICE'),))
-            haveNet = self.network.bringUp()
+            haveNet = self.network.bringUp(devices=[netdev])
             w.pop()
         else:
             netdev.set(('BOOTPROTO', 'static'))
@@ -305,7 +305,7 @@ class NetworkConfigurator:
                 return False
 
             try:
-                haveNet = self.network.bringUp()
+                haveNet = self.network.bringUp(devices=[netdev])
             except Exception, e:
                 import logging
                 log = logging.getLogger("anaconda")
diff --git a/network.py b/network.py
index 2d727b9..db14e3a 100644
--- a/network.py
+++ b/network.py
@@ -513,8 +513,12 @@ class Network:
 
         return False
 
-    def write(self, instPath='', anaconda=None):
-        if len(self.netdevices.values()) == 0:
+    def write(self, instPath='', anaconda=None, devices=None):
+
+        if devices is None:
+            devices = self.netdevices.values()
+
+        if len(devices) == 0:
             return
 
         sysconfig = "%s/etc/sysconfig" % (instPath,)
@@ -525,7 +529,7 @@ class Network:
             iutil.mkdirChain(netscripts)
 
         # /etc/sysconfig/network-scripts/ifcfg-*
-        for dev in self.netdevices.values():
+        for dev in devices:
             device = dev.get('DEVICE')
 
             cfgfile = "%s/ifcfg-%s" % (netscripts, device,)
@@ -757,8 +761,8 @@ class Network:
     # write out current configuration state and wait for NetworkManager
     # to bring the device up, watch NM state and return to the caller
     # once we have a state
-    def bringUp(self):
-        self.write()
+    def bringUp(self, devices=None):
+        self.write(devices=devices)
 
         bus = dbus.SystemBus()
         nm = bus.get_object(isys.NM_SERVICE, isys.NM_MANAGER_PATH)
diff --git a/textw/netconfig_text.py b/textw/netconfig_text.py
index 379bedd..8698f85 100644
--- a/textw/netconfig_text.py
+++ b/textw/netconfig_text.py
@@ -192,11 +192,19 @@ class NetworkConfiguratorText:
                                                  _("You must select a network device"))
                 continue
 
+            for name, dev in netdevs.items():
+                if name in selected:
+                    dev.set(('ONBOOT', 'yes'))
+                else:
+                    dev.set(('ONBOOT', 'no'))
+
+            selected_netdevs = []
             for devname in selected:
                 if not netdevs.has_key(devname):
                     continue
 
                 netdev = netdevs[devname]
+                selected_netdevs.append(netdev)
                 netdev.set(("ONBOOT", "yes"))
 
                 if self.dhcpCheckbox.selected():
@@ -264,7 +272,7 @@ class NetworkConfiguratorText:
                         continue
 
             w = self.anaconda.intf.waitWindow(_("Configuring Network Interfaces"), _("Waiting for NetworkManager"))
-            result = self.anaconda.id.network.bringUp()
+            result = self.anaconda.id.network.bringUp(devices=selected_netdevs)
             w.pop()
             if result:
                 break
-- 
1.6.0.6

_______________________________________________
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