Network interfaces are read from NetworkManager via DBus but not all interfaces must be registered when anaconda starts. This could result in reading non-existing configuration file in initialization of Network spoke.
This fix will dump configuration files for every new interface in every refresh of the Network spoke.
Resolves: rhbz#1197960
Implemented changes from closed pull request https://github.com/rhinstaller/anaconda/pull/96
From: Jiri Konecny jkonecny@redhat.com
Network interfaces are read from NetworkManager via DBus but not all interfaces must be registered when anaconda starts. This could result in reading non-existing configuration file in initialization of Network spoke.
This fix will dump configuration files for every new interface in every refresh of the Network spoke.
Resolves: rhbz#1197960 --- pyanaconda/ui/tui/spokes/network.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py index 6c71dee..e29a0c8 100644 --- a/pyanaconda/ui/tui/spokes/network.py +++ b/pyanaconda/ui/tui/spokes/network.py @@ -33,6 +33,9 @@ from pyanaconda.regexes import IPV4_PATTERN_WITHOUT_ANCHORS from pyanaconda.constants_text import INPUT_PROCESSED
+import logging +log = logging.getLogger("anaconda") + import re
__all__ = ["NetworkSpoke"] @@ -51,17 +54,27 @@ def __init__(self, app, data, storage, payload, instclass): self.errors = []
def initialize(self): - for name in nm.nm_devices(): + self._load_new_devices() + + EditTUISpoke.initialize(self) + if not self.data.network.seen: + self._update_network_data() + + def _load_new_devices(self): + devices = nm.nm_devices() + intf_dumped = network.dumpMissingDefaultIfcfgs() + if intf_dumped: + log.debug("Dumped interfaces: %s", intf_dumped) + + for name in devices: + if name in self.supported_devices: + continue if nm.nm_device_type_is_ethernet(name): # ignore slaves if nm.nm_device_setting_value(name, "connection", "slave-type"): continue self.supported_devices.append(name)
- EditTUISpoke.initialize(self) - if not self.data.network.seen: - self._update_network_data() - @property def completed(self): """ Check whether this spoke is complete or not. Do an additional @@ -126,6 +139,7 @@ def _activated_device_msg(self, devname):
def refresh(self, args=None): """ Refresh screen. """ + self._load_new_devices() EditTUISpoke.refresh(self, args)
# on refresh check if we haven't got hostname from NM on activated
Added label: master.
Does this only happen in text installs, or does the GUI spoke need to be updated as well?
Only for text installs.
In GUI there is an event loop with registered callbacks for DBus NetworkManager events (events like add device). This is problem in text mode where is no event loop therefore we can't register callback so easily.
This fix will be pushed to Rhel7 but after rebase so I didn't set label now.
Looks good to me.
Added label: ACK.
Closed.
Pushed
anaconda-patches@lists.fedorahosted.org