summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPavani Rajula <rpavani1998@gmail.com>2018-08-14 20:24:02 +0200
committerPavani Rajula <rpavani1998@gmail.com>2018-08-17 20:06:52 +0200
commit384700acdf28a54709acdd760e1103e2ed007a47 (patch)
tree07531fb44c79e09245cb04ddbe883cb654a2a15d /src
parentMerge pull request #23623 from tchaikov/wip-inline-constants (diff)
downloadceph-384700acdf28a54709acdd760e1103e2ed007a47.tar.xz
ceph-384700acdf28a54709acdd760e1103e2ed007a47.zip
tools/cephfs-shell:resolved removing directories using pattern inside sub-directories
Signed-off-by: Pavani Rajula <rpavani1998@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/tools/cephfs/cephfs-shell7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell
index da2ac795776..2f305d1df45 100644
--- a/src/tools/cephfs/cephfs-shell
+++ b/src/tools/cephfs/cephfs-shell
@@ -132,6 +132,7 @@ def locate_file(name, case_sensitive=True):
def get_all_possible_paths(pattern):
+ complete_pattern = pattern[:]
paths = []
is_rel_path = not os.path.isabs(pattern)
if is_rel_path:
@@ -145,7 +146,7 @@ def get_all_possible_paths(pattern):
for pattern in patterns:
for path in paths:
paths.extend(glob(path, pattern))
- return [path for path in paths if fnmatch.fnmatch(path, '/'*is_rel_path + pattern)]
+ return [path for path in paths if fnmatch.fnmatch(path, os.path.join(cephfs.getcwd().decode('utf-8'), complete_pattern))]
suffixes = ['B', 'K', 'M', 'G', 'T', 'P']
@@ -636,10 +637,10 @@ sub-directories, files')
else:
is_pattern = False
path = ''
- dir_path = os.path.normpath(dir_path)
+ dir_path = os.path.normpath(os.path.join(cephfs.getcwd().decode('utf-8'), dir_path))
if args.parent:
files = reversed(
- sorted(set(dirwalk(cephfs.getcwd().decode('utf-8') + dir_path))))
+ sorted(set(dirwalk(dir_path))))
for path in files:
path = os.path.normpath(path)
if path[1:] != dir_path: