[PATCH] Use shutil.move for replacing old config with the new one
Vratislav Podzimek
vpodzime at redhat.com
Mon Aug 27 10:20:14 UTC 2012
os.rename fails if source and destination are on different fileystems,
shutil.move should copy and remove the source in such cases.
Resolves: rhbz#851653
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
pyanaconda/ntp.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/ntp.py b/pyanaconda/ntp.py
index fff930f..0fed009 100644
--- a/pyanaconda/ntp.py
+++ b/pyanaconda/ntp.py
@@ -23,7 +23,10 @@ Module facilitating the work with NTP servers and NTP daemon's configuration
"""
-import re, os, tempfile
+import re
+import os
+import tempfile
+import shutil
from pyanaconda import iutil
from pyanaconda.threads import threadMgr, AnacondaThread
@@ -135,7 +138,7 @@ def save_servers_to_config(servers, conf_file_path=NTP_CONFIG_FILE,
if not out_file_path:
try:
stat = os.stat(conf_file_path)
- os.rename(temp_path, conf_file_path)
+ shutil.move(temp_path, conf_file_path)
os.chmod(conf_file_path, stat.st_mode)
except OSError as oserr:
--
1.7.11.4
More information about the anaconda-patches
mailing list