From b98242173aa0f44aff0bae3baa70aa2c13e457c2 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Wed, 19 Jun 2019 16:13:46 +0530 Subject: [PATCH] cephfs-shell: Add error message for invalid ls commands This patch prints the following error message on invalid ls command: CephFS:~/>>> ls t/ u/ y CephFS:~/>>> ls k k: no such directory exists Fixes: https://tracker.ceph.com/issues/40430 Signed-off-by: Varsha Rao --- src/tools/cephfs/cephfs-shell | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index ba4014a3b41..d5c9622f054 100755 --- a/src/tools/cephfs/cephfs-shell +++ b/src/tools/cephfs/cephfs-shell @@ -117,8 +117,9 @@ def ls(path, opts=''): elif almost_all and dent.d_name in (b'.', b'..'): continue yield dent - except cephfs.ObjectNotFound: - return [] + except libcephfs.ObjectNotFound: + perror('{}: no such directory exists'.format(path), end='\n', + apply_style=True) def glob(path, pattern): -- 2.47.3