summaryrefslogtreecommitdiffstats
path: root/pyanaconda/simpleconfig.py
diff options
context:
space:
mode:
authorRadek Vykydal <rvykydal@redhat.com>2010-06-28 18:16:51 +0200
committerRadek Vykydal <rvykydal@redhat.com>2010-06-30 15:55:16 +0200
commitee81964ca9ed44a1e0559e84641587e82a226699 (patch)
tree74de574c54e9d10a3c7df759016f73f872855fb9 /pyanaconda/simpleconfig.py
parentfbf7f127c3c8ab719ab7e54d721772ab0a40bb8c (diff)
downloadanaconda-ee81964ca9ed44a1e0559e84641587e82a226699.tar.gz
anaconda-ee81964ca9ed44a1e0559e84641587e82a226699.tar.xz
anaconda-ee81964ca9ed44a1e0559e84641587e82a226699.zip
Don't deactivate active device before running nm-c-e (#608773)
ifcfg-rh is watching IN_CLOSE_WRITE event so we should write directly into ifcfg file when updating it instead of creating temporary, removing original, and moving temporary.
Diffstat (limited to 'pyanaconda/simpleconfig.py')
-rw-r--r--pyanaconda/simpleconfig.py18
1 files changed, 3 insertions, 15 deletions
diff --git a/pyanaconda/simpleconfig.py b/pyanaconda/simpleconfig.py
index d00f52f34..4bd665ac8 100644
--- a/pyanaconda/simpleconfig.py
+++ b/pyanaconda/simpleconfig.py
@@ -16,7 +16,6 @@
import string
import os
-import tempfile
import shutil
# use our own ASCII only uppercase function to avoid locale issues
@@ -122,9 +121,8 @@ class IfcfgFile(SimpleConfigFile):
return len(self.info)
- # This method has to write file in a particular
- # way so that ifcfg-rh's inotify mechanism triggeres
- # TODORV: check that it is still true.
+ # ifcfg-rh is using inotify IN_CLOSE_WRITE event
+ # so we don't use temporary file for new configuration.
def write(self, dir=None):
"""Writes values into ifcfg file."""
@@ -133,15 +131,5 @@ class IfcfgFile(SimpleConfigFile):
else:
path = os.path.join(dir, os.path.basename(self.path))
- fd, newifcfg = tempfile.mkstemp(prefix="ifcfg-%s" % self.iface, text=False)
- os.write(fd, self.__str__())
- os.close(fd)
-
- os.chmod(newifcfg, 0644)
- try:
- os.remove(path)
- except OSError, e:
- if e.errno != 2:
- raise
- shutil.move(newifcfg, path)
+ SimpleConfigFile.write(self, path)