From: Rishabh Dave Date: Thu, 7 Nov 2019 12:14:38 +0000 (+0530) Subject: cephfs-shell: print helpful message when conf file is not found X-Git-Tag: v15.1.0~894^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F31460%2Fhead;p=ceph.git cephfs-shell: print helpful message when conf file is not found Fixes: https://tracker.ceph.com/issues/42508 Signed-off-by: Rishabh Dave --- diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index 2032515cdfec..7e9ac937e54f 100755 --- a/src/tools/cephfs/cephfs-shell +++ b/src/tools/cephfs/cephfs-shell @@ -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):