]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-shell: set exit code when Cmd2ArgparseError is caught
authorRishabh Dave <ridave@redhat.com>
Thu, 19 May 2022 12:37:39 +0000 (18:07 +0530)
committerRishabh Dave <ridave@redhat.com>
Thu, 19 May 2022 12:37:39 +0000 (18:07 +0530)
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 <ridave@redhat.com>
src/tools/cephfs/cephfs-shell

index cc1c6be25d37fd93287ab64e1bb0dcb995c878ef..7b8597a457b4806dc8cec0ff7a99938167047d04 100755 (executable)
@@ -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}')