From af817028c693ce1e500f9d3939c8bd7f688a3a68 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 9 Nov 2010 23:09:07 +0100 Subject: [PATCH] [FIX] tools.config: do not chmod existing config files lp bug: https://launchpad.net/bugs/519455 fixed bzr revid: olivier@olivier-donys-macbook-pro.local-20101109220907-t2phxs26l136bhe7 --- bin/tools/config.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/tools/config.py b/bin/tools/config.py index 2964870d427..f98cdbab1b9 100644 --- a/bin/tools/config.py +++ b/bin/tools/config.py @@ -450,11 +450,13 @@ class configmanager(object): # try to create the directories and write the file try: - if not os.path.exists(os.path.dirname(self.rcfile)): + rc_exists = os.path.exists(self.rcfile) + if not rc_exists and not os.path.exists(os.path.dirname(self.rcfile)): os.makedirs(os.path.dirname(self.rcfile)) try: p.write(file(self.rcfile, 'w')) - os.chmod(self.rcfile, 0600) + if not rc_exists: + os.chmod(self.rcfile, 0600) except IOError: sys.stderr.write("ERROR: couldn't write the config file\n")