From: Rishabh Dave Date: Thu, 19 May 2022 12:37:39 +0000 (+0530) Subject: cephfs-shell: set exit code when Cmd2ArgparseError is caught X-Git-Tag: v18.0.0~836^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c7306b7df6928ea19d7dabfdd9796f09fb80ec16;p=ceph.git cephfs-shell: set exit code when Cmd2ArgparseError is caught Not doing so, sets the exit code to zero which is not desired in case of a command failure. Fixes: https://tracker.ceph.com/issues/55710 Signed-off-by: Rishabh Dave --- diff --git a/src/tools/cephfs/cephfs-shell b/src/tools/cephfs/cephfs-shell index cc1c6be25d3..7b8597a457b 100755 --- a/src/tools/cephfs/cephfs-shell +++ b/src/tools/cephfs/cephfs-shell @@ -471,8 +471,9 @@ class CephFSShell(Cmd): if isinstance(e, Cmd2ArgparseError): # NOTE: In case of Cmd2ArgparseError the error message is # already printed beforehand (plus Cmd2ArgparseError - # instances have empty message) - pass + # instances have empty error message), so let's just set the + # exit code. + set_exit_code_msg(msg=None) else: set_exit_code_msg(msg=f'{type(e).__name__}: {e}')