From 7b8a5fcf285bca52d22148269b57fe8c9ac7b0b9 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Mon, 8 Feb 2021 10:00:21 +0100 Subject: [PATCH] mgr/dashboard: adapt to now orch interface Signed-off-by: Sebastian Wagner (cherry picked from commit b92dc7120588b53293f8fcff5180b428d7f4a1ff) --- .../mgr/dashboard/services/orchestrator.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/orchestrator.py b/src/pybind/mgr/dashboard/services/orchestrator.py index 3d25091e29960..5463c4e7a757b 100644 --- a/src/pybind/mgr/dashboard/services/orchestrator.py +++ b/src/pybind/mgr/dashboard/services/orchestrator.py @@ -6,8 +6,8 @@ from functools import wraps from typing import Any, Dict, List, Optional from ceph.deployment.service_spec import ServiceSpec -from orchestrator import Completion, DaemonDescription, DeviceLightLoc, \ - HostSpec, InventoryFilter, OrchestratorClientMixin, OrchestratorError, \ +from orchestrator import DaemonDescription, DeviceLightLoc, HostSpec, \ + InventoryFilter, OrchestratorClientMixin, OrchestratorError, OrchResult, \ ServiceDescription, raise_if_exception from .. import mgr @@ -31,15 +31,11 @@ class OrchestratorAPI(OrchestratorClientMixin): available=False, message='Orchestrator is unavailable: {}'.format(str(e))) - def orchestrator_wait(self, completions): - return self._orchestrator_wait(completions) - def wait_api_result(method): @wraps(method) def inner(self, *args, **kwargs): completion = method(self, *args, **kwargs) - self.api.orchestrator_wait([completion]) raise_if_exception(completion) return completion.result return inner @@ -68,11 +64,11 @@ class HostManger(ResourceManager): return self.api.remove_host(hostname) @wait_api_result - def add_label(self, host: str, label: str) -> Completion: + def add_label(self, host: str, label: str) -> OrchResult[str]: return self.api.add_host_label(host, label) @wait_api_result - def remove_label(self, host: str, label: str) -> Completion: + def remove_label(self, host: str, label: str) -> OrchResult[str]: return self.api.remove_host_label(host, label) @@ -117,7 +113,7 @@ class ServiceManager(ResourceManager): raise_if_exception(c) @wait_api_result - def apply(self, service_spec: Dict) -> Completion: + def apply(self, service_spec: Dict) -> OrchResult[List[str]]: spec = ServiceSpec.from_json(service_spec) return self.api.apply([spec]) @@ -178,7 +174,7 @@ class OrchClient(object): @wait_api_result def blink_device_light(self, hostname, device, ident_fault, on): - # type: (str, str, str, bool) -> Completion + # type: (str, str, str, bool) -> OrchResult[List[str]] return self.api.blink_device_light( ident_fault, on, [DeviceLightLoc(hostname, device, device)]) -- 2.39.5