]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
better path checking when attempting to write the config 107/head
authorAlfredo Deza <alfredo.deza@inktank.com>
Thu, 17 Oct 2013 13:20:04 +0000 (09:20 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Thu, 17 Oct 2013 13:20:04 +0000 (09:20 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/hosts/remotes.py

index 19c803850b1cf661d592ba3d89bbd1acf5cedbd8..b556fbe7d44ed3cbbf69c28897167e54ee11a981 100644 (file)
@@ -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):