From c7306b7df6928ea19d7dabfdd9796f09fb80ec16 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Thu, 19 May 2022 18:07:39 +0530 Subject: [PATCH] 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 --- src/tools/cephfs/cephfs-shell | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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}') -- 2.39.5