[PATCH 1/2 master] Don't fail on write of nonexisting IfcfgFile(SimpleConfigFile) (#849012, #849095)
Radek Vykydal
rvykydal at redhat.com
Mon Aug 20 12:38:05 UTC 2012
Due to commit 16a7c6e7af3df4816323a007f785155d307869bf,
SimpleConfigFile.write of nonexisting files is failling.
---
pyanaconda/simpleconfig.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/simpleconfig.py b/pyanaconda/simpleconfig.py
index db0dea2..9fb1289 100644
--- a/pyanaconda/simpleconfig.py
+++ b/pyanaconda/simpleconfig.py
@@ -95,9 +95,12 @@ class SimpleConfigFile(object):
# Move the temporary file (with 0600 permissions) over the top of the
# original and preserve the original's permissions
filename = os.path.realpath(filename)
- m = os.stat(filename)
+ if os.path.exists(filename):
+ m = os.stat(filename).st_mode
+ else:
+ m = int('0100644', 8)
shutil.move(tmpf.name, filename)
- os.chmod(filename, m.st_mode)
+ os.chmod(filename, m)
def set(self, *args):
for key, value in args:
--
1.7.4
More information about the anaconda-patches
mailing list