From 8dc7de7e0675bb23256418c0dd1fc8df123b6796 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 (cherry picked from commit 6b76753c3cabf9663fa1daa47c7bcb7df110a94c) --- 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 2c80175fb47..0f69382684c 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -2000,6 +2000,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.47.3