Make ifcfg configuration files getting parsed properly after update. The used inotify configuration update mechanism (ifcfg-rh NM plugin) requires 1) writing of new files out of /etc/sysconfig/network-scripts dir so that it doesn't trigger parsing of the file too early (before all is written), and more importantly, 2) removing of the old files before moving the new ones in so that the new file gets parsed and the respective connection gets re-read and eventually activated. Also make sure that only device selected in UI has ONBOOT set to yes in case of selection of another device after fail. --- iw/netconfig_dialog.py | 8 ++++++-- network.py | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/iw/netconfig_dialog.py b/iw/netconfig_dialog.py index 29afc0e..ea59613 100644 --- a/iw/netconfig_dialog.py +++ b/iw/netconfig_dialog.py @@ -226,8 +226,12 @@ class NetworkConfigurator: combo = self.xml.get_widget("interfaceCombo") active = combo.get_active_iter() val = combo.get_model().get_value(active, 1) - netdev = self.network.available()[val] - netdev.set(('ONBOOT', 'yes')) + for v, dev in self.network.available().items(): + if v == val: + dev.set(('ONBOOT', 'yes')) + netdev = dev + else: + dev.set(('ONBOOT', 'no')) # FIXME: need to do input validation if self.xml.get_widget("dhcpCheckbutton").get_active(): diff --git a/network.py b/network.py index f597c9d..9a8d7d2 100644 --- a/network.py +++ b/network.py @@ -538,7 +538,7 @@ class Network: ipv6autoconf = dev.get('IPV6_AUTOCONF').lower() dhcpv6c = dev.get('DHCPV6C').lower() - newifcfg = "%s/ifcfg-%s.new" % (netscripts, device,) + newifcfg = "/tmp/ifcfg-%s.new" % (device,) f = open(newifcfg, "w") if len(dev.get("DESC")) > 0: f.write("# %s\n" % (dev.get("DESC"),)) @@ -596,6 +596,11 @@ class Network: # move the new ifcfg in place destcfg = "%s/ifcfg-%s" % (netscripts, device,) + try: + os.remove(destcfg) + except OSError as e: + if e.errno != 2: + raise shutil.move(newifcfg, destcfg) # XXX: is this necessary with NetworkManager? -- 1.6.0.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list