From: Kefu Chai Date: Tue, 14 Aug 2018 01:59:00 +0000 (+0800) Subject: tools/cephfs: do not split args if it's already a list X-Git-Tag: v14.0.1~520^2~7^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F23561%2Fhead;p=ceph.git tools/cephfs: do not split args if it's already a list Signed-off-by: Kefu Chai --- diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index 5667b4b17b3..b1b83b7b070 100644 --- a/src/tools/cephfs/cephfs-shell +++ b/src/tools/cephfs/cephfs-shell @@ -21,11 +21,14 @@ try: except ImportError: def with_argparser(argparser): import functools + def argparser_decorator(func): @functools.wraps(func) def wrapper(thiz, cmdline): - # do not split if it's already a list - if not isinstance(cmdline, list): + if isinstance(cmdline, list): + arglist = cmdline + else: + # do not split if it's already a list arglist = shlex.split(cmdline, posix=False) # in case user quotes the command args arglist = [arg.strip('\'""') for arg in arglist] @@ -119,7 +122,8 @@ def glob(dir_name, pattern): if fnmatch.fnmatch(i.d_name.decode('utf-8'), pattern): paths.append(os.path.join(dir_name, i.d_name.decode('utf-8'))) return paths - + + def get_all_possible_paths(pattern): paths = [] is_rel_path = not os.path.isabs(pattern)