summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Vykydal <rvykydal@redhat.com>2009-07-14 12:23:37 +0200
committerRadek Vykydal <rvykydal@redhat.com>2009-07-20 14:01:04 +0200
commitcee4eef6a4ab0503d8dd3c650d7a2b819432d781 (patch)
treeabfc59664368980f4481012c4ac074ce1b85a584
parent6dc159708058136522c9ec2f62287a1d0c22f0a4 (diff)
downloadanaconda-cee4eef6a4ab0503d8dd3c650d7a2b819432d781.tar.gz
anaconda-cee4eef6a4ab0503d8dd3c650d7a2b819432d781.tar.xz
anaconda-cee4eef6a4ab0503d8dd3c650d7a2b819432d781.zip
Fix selection of alternative iface in UI after fail (#507084).
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.
-rw-r--r--iw/netconfig_dialog.py8
-rw-r--r--network.py7
2 files changed, 12 insertions, 3 deletions
diff --git a/iw/netconfig_dialog.py b/iw/netconfig_dialog.py
index 29afc0ea4..ea59613de 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 f597c9d7c..9a8d7d2bb 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?