[master 3/5] Remove an unnecessary chmod when creating chrony.conf

dashea installerbot-noreply at redhat.com
Tue Jul 14 21:56:35 UTC 2015


From: David Shea <dshea at redhat.com>

Instead of copying the file contents and permissions and then resetting
the permissions, just copy the file contents. The selinux context will
be correctly applied to new files and unchanged for existing files, just
as with shutil.copy.
---
 pyanaconda/ntp.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/pyanaconda/ntp.py b/pyanaconda/ntp.py
index 701fd8d..1dd5799 100644
--- a/pyanaconda/ntp.py
+++ b/pyanaconda/ntp.py
@@ -31,7 +31,6 @@
 import socket
 
 from pyanaconda import isys
-from pyanaconda import iutil
 from pyanaconda.iutil import open   # pylint: disable=redefined-builtin
 from pyanaconda.threads import threadMgr, AnacondaThread
 from pyanaconda.constants import THREAD_SYNC_TIME_BASENAME
@@ -192,10 +191,8 @@ def save_servers_to_config(pools, servers, conf_file_path=NTP_CONFIG_FILE,
 
     if not out_file_path:
         try:
-            stat = os.stat(conf_file_path)
             # Use copy rather then move to get the correct selinux context
-            shutil.copy(temp_path, conf_file_path)
-            iutil.eintr_retry_call(os.chmod, conf_file_path, stat.st_mode)
+            shutil.copyfile(temp_path, conf_file_path)
             os.unlink(temp_path)
 
         except OSError as oserr:


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/278ac9c1ebc7a8764f0ba6567048a398aba9e6ce


More information about the anaconda-patches mailing list