From: Sebastian Wagner Date: Mon, 13 Sep 2021 14:05:03 +0000 (+0200) Subject: mgr/cephadm: Raise errors to properly set a cli status code X-Git-Tag: v17.1.0~325^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1a87e5eaf54b30c1974ed02aa7e69656d0106c27;p=ceph.git mgr/cephadm: Raise errors to properly set a cli status code otherwise `ceph orch host rm` will return 0 Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 414013ad5a01..5e4da608a673 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1382,13 +1382,15 @@ Then run the following: host_offline = host in self.offline_hosts if host_offline and not offline: - return "{} is offline, please use --offline and --force to remove this host. This can potentially cause data loss".format(host) + raise OrchestratorValidationError( + "{} is offline, please use --offline and --force to remove this host. This can potentially cause data loss".format(host)) if not host_offline and offline: - return "{} is online, please remove host without --offline.".format(host) + raise OrchestratorValidationError( + "{} is online, please remove host without --offline.".format(host)) if offline and not force: - return "Removing an offline host requires --force" + raise OrchestratorValidationError("Removing an offline host requires --force") # check if there are daemons on the host if not force: