From: Milind Changire Date: Fri, 12 Apr 2019 16:59:40 +0000 (+0530) Subject: cephfs-shell: fix rmdir command X-Git-Tag: v15.1.0~2908^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0340b9e098889838e39b5044aa8f187d14fd0bb5;p=ceph.git cephfs-shell: fix rmdir command Signed-off-by: Milind Changire --- diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index 5622cd4217e..f8653043d79 100755 --- a/src/tools/cephfs/cephfs-shell +++ b/src/tools/cephfs/cephfs-shell @@ -731,7 +731,7 @@ sub-directories, files') dirs = [] for i in all_items: for item in list_items(dir_path): - d_name = item.d_name.decode('utf-8') + d_name = item.d_name if os.path.basename(i) == d_name: if item.is_dir(): dirs.append(os.path.join(dir_path, d_name)) @@ -753,7 +753,10 @@ sub-directories, files') except libcephfs.Error: cephfs.unlink(to_bytes(path)) if not is_pattern and dir_path != os.path.normpath(path): - cephfs.rmdir(to_bytes(dir_path)) + try: + cephfs.rmdir(to_bytes(dir_path)) + except: + self.poutput('error: no such directory "%s"' % dir_path) def complete_rm(self, text, line, begidx, endidx): """