]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
fix invalid path handling
authorAlfredo Deza <alfredo.deza@inktank.com>
Tue, 4 Mar 2014 18:33:55 +0000 (13:33 -0500)
committerAlfredo Deza <alfredo.deza@inktank.com>
Tue, 4 Mar 2014 18:33:55 +0000 (13:33 -0500)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/conf/cephdeploy.py

index a4fa34c4f3991f954068cd4ea097264ca5ceaa12..a5b85a23f9b1ed80eaebf55d62c44545d1ccf535 100644 (file)
@@ -3,24 +3,34 @@ from os import path
 
 
 cd_conf_template = """
+#
+# ceph-deploy configuration file
+#
+
+
 """
 
 
 def location():
+    """
+    Find and return the location of the ceph-deploy configuration file. If this
+    file does not exist, create one in a default location.
+    """
     return _locate_or_create()
 
 
 def _locate_or_create():
+    home_config = path.expanduser('~/.cephdeploy.conf')
     # With order of importance
     locations = [
-        path.join(path.dirname(os.getcwd(), 'cephdeploy.conf')),
-        path.expanduser('~/.cephdeploy.conf'),
+        path.join(path.dirname(os.getcwd()), 'cephdeploy.conf'),
+        home_config,
     ]
 
     for location in locations:
         if path.exists(location):
             return location
-    create_stub(path.expanduser('~/.cephdeploy.conf'))
+    create_stub(home_config)
 
 
 def create_stub(_path=None):