]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: warn users if they try to pass a daemon to 'orch rm'
authorAdam King <adking@redhat.com>
Tue, 11 May 2021 17:47:55 +0000 (13:47 -0400)
committerSage Weil <sage@newdream.net>
Thu, 20 May 2021 23:11:29 +0000 (18:11 -0500)
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit b07efcb4192ad5988baf3bb92df42cea877a8351)

src/pybind/mgr/cephadm/module.py

index 9cfd6ee0e5a69565e59988717797243db10e6f35..49e426eba1718bbfe23b1ad61668bf1c05dd18f1 100644 (file)
@@ -1930,7 +1930,12 @@ Then run the following:
             return 'Removed service %s' % service_name
         else:
             # must be idempotent: still a success.
-            return f'Failed to remove service. <{service_name}> was not found.'
+            try:
+                self.cache.get_daemon(service_name)
+                return (f'Failed to remove service <{service_name}>. "{service_name}" is the name of a daemon, not a service. '
+                        + 'Running service names can be found with "ceph orch ls"')
+            except OrchestratorError:
+                return f'Failed to remove service. <{service_name}> was not found. Running service names can be found with "ceph orch ls"'
 
     @handle_orch_error
     def get_inventory(self, host_filter: Optional[orchestrator.InventoryFilter] = None, refresh: bool = False) -> List[orchestrator.InventoryHost]: