[rhel7-branch 1/1] network: create ifcfg files in tui if needed (#1267526)

rvykydal installerbot-noreply at redhat.com
Wed Oct 7 08:27:31 UTC 2015


From: Radek Vykydal <rvykydal at redhat.com>

When a device is activated in dracut and ipv4 dhcp fails, while ipv6
autoconfiguration succeeds (it can happen when no ip= is specified and dracut
tries dhcp4 on all devices), ifcfg file is not created in dracut, and NM
creates in-memory connection for the active device. Installer needs to dump
this connection to ifcfg file for network tui.

In the future we want to get rid of this assumption (NICs have ifcfg files in
installer) and work with NM connections directly.
---
 pyanaconda/ui/tui/spokes/network.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py
index e9b06b4..e2faedf 100644
--- a/pyanaconda/ui/tui/spokes/network.py
+++ b/pyanaconda/ui/tui/spokes/network.py
@@ -192,6 +192,21 @@ def input(self, args, key):
             # configure device
             devname = self.supported_devices[num-2]
             ndata = network.ksdata_from_ifcfg(devname)
+            if not ndata:
+                try:
+                    nm.nm_device_setting_value(devname, "connection", "uuid")
+                except nm.SettingsNotFoundError:
+                    pass
+                else:
+                    nm.nm_update_settings_of_device(devname, [['connection', 'id', devname, None]])
+                    log.debug("network: dumping ifcfg file for in-memory connection %s", devname)
+                    ndata = network.ksdata_from_ifcfg(devname)
+
+            if not ndata:
+                log.debug("network: can't find any connection for %s", devname)
+                #self.errors.append(_("Configuration of device not found"))
+                return INPUT_PROCESSED
+
             newspoke = ConfigureNetworkSpoke(self.app, self.data, self.storage,
                                     self.payload, self.instclass, ndata)
             self.app.switch_screen_modal(newspoke)


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/015dba8a7aef284f51bca1d901351894320299cd


More information about the anaconda-patches mailing list