[PATCH rhel6-branch] (take II) Don't deactivate active device before running nm-c-e (#608773)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 simpleconfig.py |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/simpleconfig.py b/simpleconfig.py
index 23fcaaa..3bc8d0b 100644
--- a/simpleconfig.py
+++ b/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
@@ -124,9 +123,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."""
 
@@ -135,15 +133,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)
 
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux