]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-shell: print helpful message when conf file is not found 31460/head
authorRishabh Dave <ridave@redhat.com>
Thu, 7 Nov 2019 12:14:38 +0000 (17:44 +0530)
committerRishabh Dave <ridave@redhat.com>
Tue, 12 Nov 2019 04:04:16 +0000 (09:34 +0530)
Fixes: https://tracker.ceph.com/issues/42508
Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/tools/cephfs/cephfs-shell

index 2032515cdfec4a7fcfc39792d25ef4e0518eff04..7e9ac937e54f21617a6f55e80604b2027c9b7669 100755 (executable)
@@ -71,9 +71,22 @@ def setup_cephfs(config_file):
     """
     Mounting a cephfs
     """
+    from cephfs import ObjectNotFound
+    from cephfs import Error
+
     global cephfs
-    cephfs = libcephfs.LibCephFS(conffile=config_file)
-    cephfs.mount()
+    try:
+        cephfs = libcephfs.LibCephFS(conffile=config_file)
+        cephfs.mount()
+    except ObjectNotFound as e:
+        print('couldn\'t find ceph configuration not found')
+        sys.exit(1)
+    except Error as e:
+        print(e)
+        sys.exit(1)
+    else:
+        del ObjectNotFound
+        del Error
 
 
 def mode_notation(mode):