From: Milind Changire Date: Sat, 13 Apr 2019 05:22:53 +0000 (+0530) Subject: cephfs-shell: fix lls command X-Git-Tag: v15.1.0~2908^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a8205b503f66016ef8f74760f4628c1675196492;p=ceph-ci.git cephfs-shell: fix lls command Signed-off-by: Milind Changire --- diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index 3c48e190765..ef1cb3bfa85 100755 --- a/src/tools/cephfs/cephfs-shell +++ b/src/tools/cephfs/cephfs-shell @@ -951,14 +951,25 @@ sub-directories, files') Lists all files and folders in the current local directory """ - if len(args.paths) == 1 and args.paths[0] == '': - args.paths.pop(0) + if len(args.paths) == 0 or (len(args.paths) == 1 and + args.paths[0] == ''): + if len(args.paths) > 0: + args.paths.pop(0) args.paths.append(os.getcwd()) for path in args.paths: - if os.path.isabs(path): - path = os.path.relpath(os.getcwd(), '/' + path) - items = os.listdir(path) - print_list(items) + if not os.path.isabs(path): + path = os.path.relpath(path) + if os.path.isdir(path): + self.poutput("%s:" % path) + items = os.listdir(path) + print_list(items) + else: + self.poutput("%s: no such directory" % path) + # Arguments to the with_argpaser decorator function are sticky. + # The items in args.path do not get overwritten in subsequent calls. + # The arguments remain in args.paths after the function exits and we + # neeed to clean it up to ensure the next call works as expected. + args.paths.clear() def do_lpwd(self, arglist): """