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>
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: