diff options
author | Radek Vykydal <rvykydal@redhat.com> | 2009-07-14 12:23:37 +0200 |
---|---|---|
committer | Radek Vykydal <rvykydal@redhat.com> | 2009-07-20 14:01:04 +0200 |
commit | cee4eef6a4ab0503d8dd3c650d7a2b819432d781 (patch) | |
tree | abfc59664368980f4481012c4ac074ce1b85a584 /network.py | |
parent | 6dc159708058136522c9ec2f62287a1d0c22f0a4 (diff) | |
download | anaconda-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.
Diffstat (limited to 'network.py')
-rw-r--r-- | network.py | 7 |
1 files changed, 6 insertions, 1 deletions
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? |