Skip to content

Commit

Permalink
mgr/orchestrator: pass 'force' flag down for remove_service
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Nov 9, 2021
1 parent ac6766c commit 575b7c9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pybind/mgr/cephadm/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ def remove_daemons(self, names):
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:
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/orchestrator/_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def remove_daemons(self, names: List[str]) -> OrchResult[List[str]]:
"""
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).
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/orchestrator/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ def _service_rm(self,
"""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())

Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/rook/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def _get_pool_params(self) -> Tuple[int, str]:
return num_replicas, leaf_type

@handle_orch_error
def remove_service(self, service_name: str) -> str:
def remove_service(self, service_name: str, force: bool = False) -> str:
if service_name == 'rbd-mirror':
return self.rook_cluster.rm_service('cephrbdmirrors', 'default-rbd-mirror')
service_type, service_name = service_name.split('.', 1)
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/test_orchestrator/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def remove_daemons(self, names):
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'

Expand Down

0 comments on commit 575b7c9

Please sign in to comment.