]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/orchestrator/cli: fix OrchestratorError retval sign 67652/head
authorNitzanMordhai <nmordech@ibm.com>
Wed, 4 Mar 2026 14:08:54 +0000 (14:08 +0000)
committerNitzanMordhai <nmordech@ibm.com>
Wed, 4 Mar 2026 14:08:59 +0000 (14:08 +0000)
OrchestratorError stores errno as abs(), so e.errno is always positive.
Returning retval=e.errno (+22) caused the ceph CLI to exit 0 since it
only propagates the exit code when ret < 0.

Fix by returning retval=-e.errno.

Fixes: https://tracker.ceph.com/issues/75282
Signed-off-by: Nitzan Mordhai <nmordech@redhat.com>
src/pybind/mgr/orchestrator/cli.py

index 76f57fd37c223ba8d143a747976461bba7c8e86f..4ef3fa58da460f6804f0d7b47f19243b9682a39a 100644 (file)
@@ -18,7 +18,7 @@ class OrchestratorCLICommandBase(CLICommandBase):
                 return func(*args, **kwargs)
             except (OrchestratorError, SpecValidationError) as e:
                 # Do not print Traceback for expected errors.
-                return HandleCommandResult(retval=e.errno, stderr=str(e))
+                return HandleCommandResult(retval=-e.errno, stderr=str(e))
             except ImportError as e:
                 return HandleCommandResult(retval=-errno.ENOENT, stderr=str(e))
             except NotImplementedError: