[anaconda] Use copy instead of move for NTP configuration (#985566)

Vratislav Podzimek vpodzime at redhat.com
Thu Sep 5 10:19:25 UTC 2013


From: Hans de Goede <hdegoede at redhat.com>

Copy preserves the SElinux context.
---
 pyanaconda/ntp.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ntp.py b/pyanaconda/ntp.py
index 10b64dc..a42a570 100644
--- a/pyanaconda/ntp.py
+++ b/pyanaconda/ntp.py
@@ -150,8 +150,10 @@ def save_servers_to_config(servers, conf_file_path=NTP_CONFIG_FILE,
     if not out_file_path:
         try:
             stat = os.stat(conf_file_path)
-            shutil.move(temp_path, conf_file_path)
+            # Use copy rather then move to get the correct selinux context
+            shutil.copy(temp_path, conf_file_path)
             os.chmod(conf_file_path, stat.st_mode)
+            os.unlink(temp_path)
 
         except OSError as oserr:
             msg = "Cannot replace the old config with "\
-- 
1.7.11.7



More information about the anaconda-patches mailing list