From 6b76753c3cabf9663fa1daa47c7bcb7df110a94c Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Tue, 31 May 2022 12:11:03 +0200 Subject: [PATCH] mgr/cephadm: check if a service exists before trying to restart it Fixes: https://tracker.ceph.com/issues/55800 Signed-off-by: Redouane Kachach --- src/pybind/mgr/cephadm/module.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 766ea77266dc2..35ee5c0fa9d49 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1890,6 +1890,9 @@ Then run the following: @handle_orch_error def service_action(self, action: str, service_name: str) -> List[str]: + if service_name not in self.spec_store.all_specs.keys(): + raise OrchestratorError(f'Invalid service name "{service_name}".' + + ' View currently running services using "ceph orch ls"') dds: List[DaemonDescription] = self.cache.get_daemons_by_service(service_name) if not dds: raise OrchestratorError(f'No daemons exist under service name "{service_name}".' -- 2.39.5