From 5317bdc107b1c7d6260320ad8cac2adb18f89c9d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 8 Nov 2021 12:04:27 -0500 Subject: [PATCH] mgr/orchestrator: pass 'force' flag down for remove_service Signed-off-by: Sage Weil (cherry picked from commit 575b7c9a98608c4f266d8e406118544916f1b8d6) Conflicts: src/pybind/mgr/rook/module.py --- src/pybind/mgr/cephadm/module.py | 2 +- src/pybind/mgr/orchestrator/_interface.py | 2 +- src/pybind/mgr/orchestrator/module.py | 2 +- src/pybind/mgr/rook/module.py | 2 +- src/pybind/mgr/test_orchestrator/module.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index c88a4a6bdbc18..665ee1a231b6a 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -2054,7 +2054,7 @@ Then run the following: return self._remove_daemons(args) @handle_orch_error - def remove_service(self, service_name: str) -> str: + def remove_service(self, service_name: str, force: bool = False) -> str: self.log.info('Remove service %s' % service_name) self._trigger_preview_refresh(service_name=service_name) if service_name in self.spec_store: diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index c6be1e16fbd3d..18eb1d9be6376 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -491,7 +491,7 @@ class Orchestrator(object): """ raise NotImplementedError() - def remove_service(self, service_name: str) -> OrchResult[str]: + def remove_service(self, service_name: str, force: bool = False) -> OrchResult[str]: """ Remove a service (a collection of daemons). diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index b783ca64e7ac9..19bc7b5bca9b6 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1013,7 +1013,7 @@ Usage: """Remove a service""" if service_name in ['mon', 'mgr'] and not force: raise OrchestratorError('The mon and mgr services cannot be removed') - completion = self.remove_service(service_name) + completion = self.remove_service(service_name, force=force) raise_if_exception(completion) return HandleCommandResult(stdout=completion.result_str()) diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index d874e11aed732..964d5548ada85 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -401,7 +401,7 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator): return result @handle_orch_error - def remove_service(self, service_name: str) -> str: + def remove_service(self, service_name: str, force: bool = False) -> str: service_type, service_name = service_name.split('.', 1) if service_type == 'mds': return self.rook_cluster.rm_service('cephfilesystems', service_name) diff --git a/src/pybind/mgr/test_orchestrator/module.py b/src/pybind/mgr/test_orchestrator/module.py index 9d172737777fe..d89c23bf1593c 100644 --- a/src/pybind/mgr/test_orchestrator/module.py +++ b/src/pybind/mgr/test_orchestrator/module.py @@ -227,7 +227,7 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator): return 'done' @handle_orch_error - def remove_service(self, service_name): + def remove_service(self, service_name, force = False): assert isinstance(service_name, str) return 'done' -- 2.39.5