From: Milind Changire Date: Sat, 13 Apr 2019 05:08:02 +0000 (+0530) Subject: cephfs-shell: fix chmod command X-Git-Tag: v15.1.0~2908^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=39f11515a9f411cb3285b29b4a6fd5cadbbbebf9;p=ceph.git cephfs-shell: fix chmod command Signed-off-by: Milind Changire --- diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index 49635b2b4336..29aee0d5f927 100755 --- a/src/tools/cephfs/cephfs-shell +++ b/src/tools/cephfs/cephfs-shell @@ -845,7 +845,7 @@ sub-directories, files') return self.complete_filenames(text, line, begidx, endidx) chmod_parser = argparse.ArgumentParser(description='Create Directory.') - chmod_parser.add_argument('mode', type=int, help='Mode') + chmod_parser.add_argument('mode', type=str, action=ModeAction, help='Mode') chmod_parser.add_argument('file_name', type=str, help='Name of the file') @with_argparser(chmod_parser) @@ -853,7 +853,11 @@ sub-directories, files') """ Change permission of a file """ - cephfs.chmod(args.file_name, args.mode) + mode = int(args.mode, base=8) + try: + cephfs.chmod(args.file_name, mode) + except: + self.poutput('%s: no such file or directory' % args.file_name) def complete_cat(self, text, line, begidx, endidx): """