From aeb2fcfa569d37ac0fa2772dc3a23676d71732e3 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Thu, 7 Nov 2019 17:44:38 +0530 Subject: [PATCH] cephfs-shell: print helpful message when conf file is not found Fixes: https://tracker.ceph.com/issues/42508 Signed-off-by: Rishabh Dave --- src/tools/cephfs/cephfs-shell | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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): -- 2.47.3