From: Redouane Kachach Date: Tue, 31 May 2022 10:11:03 +0000 (+0200) Subject: mgr/cephadm: check if a service exists before trying to restart it X-Git-Tag: v18.0.0~784^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6b76753c3cabf9663fa1daa47c7bcb7df110a94c;p=ceph.git mgr/cephadm: check if a service exists before trying to restart it Fixes: https://tracker.ceph.com/issues/55800 Signed-off-by: Redouane Kachach --- 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}".'