From: Adam King Date: Tue, 11 May 2021 17:47:55 +0000 (-0400) Subject: mgr/cephadm: warn users if they try to pass a daemon to 'orch rm' X-Git-Tag: v16.2.5~115^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5184676d33c1f86c1f4da8c04d21fb8e61dafeef;p=ceph.git mgr/cephadm: warn users if they try to pass a daemon to 'orch rm' Signed-off-by: Adam King (cherry picked from commit b07efcb4192ad5988baf3bb92df42cea877a8351) --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 9cfd6ee0e5a6..49e426eba171 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -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]: