]> 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>
Mon, 29 Nov 2021 10:51:11 +0000 (11:51 +0100)
otherwise `ceph orch host rm` will return 0

Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
src/pybind/mgr/cephadm/module.py

index 414013ad5a017f5133bd573911f8f00e813a9334..5e4da608a673fe05863cae3e1a621f046e5f90c4 100644 (file)
@@ -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: