From ee81964ca9ed44a1e0559e84641587e82a226699 Mon Sep 17 00:00:00 2001 From: Radek Vykydal Date: Mon, 28 Jun 2010 18:16:51 +0200 Subject: 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. --- pyanaconda/simpleconfig.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'pyanaconda/simpleconfig.py') 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) -- cgit