]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-shell: fix rmdir command
authorMilind Changire <mchangir@redhat.com>
Fri, 12 Apr 2019 16:59:40 +0000 (22:29 +0530)
committerMilind Changire <mchangir@redhat.com>
Sat, 13 Apr 2019 06:36:25 +0000 (12:06 +0530)
Signed-off-by: Milind Changire <mchangir@redhat.com>
src/tools/cephfs/cephfs-shell

index 5622cd4217ee9875859b6d966f6257847318727f..f8653043d79d6f4402d1591eaceacc6ad6b630eb 100755 (executable)
@@ -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):
         """