From: Alfredo Deza Date: Thu, 17 Oct 2013 13:20:04 +0000 (-0400) Subject: better path checking when attempting to write the config X-Git-Tag: v1.3~16^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d8b9a2b43e586654e2d1aba05de222552ffcf67b;p=ceph-deploy.git better path checking when attempting to write the config Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/hosts/remotes.py b/ceph_deploy/hosts/remotes.py index 19c8038..b556fbe 100644 --- a/ceph_deploy/hosts/remotes.py +++ b/ceph_deploy/hosts/remotes.py @@ -40,8 +40,15 @@ def write_conf(cluster, conf, overwrite): old = f.read() if old != conf and not overwrite: raise RuntimeError(err_msg) - tmp_file.write(conf) - os.rename(tmp_file.name, path) + tmp_file.write(conf) + os.rename(tmp_file.name, path) + return + if os.path.exists('/etc/ceph'): + with open(path, 'w') as f: + f.write(conf) + else: + err_msg = '/etc/ceph/ does not exist - could not write config' + raise RuntimeError(err_msg) def write_keyring(path, key):