[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
This commit is contained in:
parent
ad4f3dfc0b
commit
af817028c6
|
@ -450,11 +450,13 @@ class configmanager(object):
|
||||||
|
|
||||||
# try to create the directories and write the file
|
# try to create the directories and write the file
|
||||||
try:
|
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))
|
os.makedirs(os.path.dirname(self.rcfile))
|
||||||
try:
|
try:
|
||||||
p.write(file(self.rcfile, 'w'))
|
p.write(file(self.rcfile, 'w'))
|
||||||
os.chmod(self.rcfile, 0600)
|
if not rc_exists:
|
||||||
|
os.chmod(self.rcfile, 0600)
|
||||||
except IOError:
|
except IOError:
|
||||||
sys.stderr.write("ERROR: couldn't write the config file\n")
|
sys.stderr.write("ERROR: couldn't write the config file\n")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue