summaryrefslogtreecommitdiffstats
path: root/pyanaconda/simpleconfig.py
diff options
context:
space:
mode:
authorRadek Vykydal <rvykydal@redhat.com>2012-08-20 14:05:14 +0200
committerRadek Vykydal <rvykydal@redhat.com>2012-08-20 17:24:16 +0200
commit551eb8a662b5fb74f3ce4c89138f81b42f5f49f4 (patch)
treef722c36e6490d1d69ccb00155e6550ec88b7399f /pyanaconda/simpleconfig.py
parent51b900fff2220a5288303369828f1bd3a3532c6b (diff)
downloadanaconda-551eb8a662b5fb74f3ce4c89138f81b42f5f49f4.tar.gz
anaconda-551eb8a662b5fb74f3ce4c89138f81b42f5f49f4.tar.xz
anaconda-551eb8a662b5fb74f3ce4c89138f81b42f5f49f4.zip
Don't fail on write of nonexisting IfcfgFile(SimpleConfigFile) (#849012, #849095)
Due to commit 16a7c6e7af3df4816323a007f785155d307869bf, SimpleConfigFile.write of nonexisting files is failling.
Diffstat (limited to 'pyanaconda/simpleconfig.py')
-rw-r--r--pyanaconda/simpleconfig.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pyanaconda/simpleconfig.py b/pyanaconda/simpleconfig.py
index db0dea22a..9fb128995 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: