]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: Raise errors to properly set a cli status code
authorSebastian Wagner <sewagner@redhat.com>
Mon, 13 Sep 2021 14:05:03 +0000 (16:05 +0200)
committerSebastian Wagner <sewagner@redhat.com>
Tue, 18 Jan 2022 10:21:32 +0000 (11:21 +0100)
otherwise `ceph orch host rm` will return 0

Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
(cherry picked from commit 1a87e5eaf54b30c1974ed02aa7e69656d0106c27)

src/pybind/mgr/cephadm/module.py

index 8daac1e884ad75956d8907c9415c3396e7209069..64c94314d9c327dd74c9cb8db5fab8387ecf8d15 100644 (file)
@@ -1526,13 +1526,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: