From 65a6a1759b075503fb191323cb3e62e18e136ce8 Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Wed, 21 Oct 2020 14:13:32 +0200 Subject: [PATCH] mgr/dashboard: Fix property name in orchestrator status response The response of the 'status' endpoint of the 'orchestrator' controller contains the property 'description' instead of 'message' as this is done by other 'status' endpoints. Fixes: https://tracker.ceph.com/issues/47926 Signed-off-by: Volker Theile --- src/pybind/mgr/dashboard/controllers/orchestrator.py | 2 +- .../inventory-devices.component.spec.ts | 3 ++- .../src/app/shared/models/orchestrator.interface.ts | 2 +- src/pybind/mgr/dashboard/openapi.yaml | 6 +++--- src/pybind/mgr/dashboard/services/orchestrator.py | 10 +++++----- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/orchestrator.py b/src/pybind/mgr/dashboard/controllers/orchestrator.py index 6b2d9bb4c133..13b4a171a895 100644 --- a/src/pybind/mgr/dashboard/controllers/orchestrator.py +++ b/src/pybind/mgr/dashboard/controllers/orchestrator.py @@ -16,7 +16,7 @@ from . import ApiController, ControllerDoc, Endpoint, EndpointDoc, \ STATUS_SCHEMA = { "available": (bool, "Orchestrator status"), - "description": (str, "Description") + "message": (str, "Error message") } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts index 8bc8f8c9ad70..58a6cf1698e7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.spec.ts @@ -13,6 +13,7 @@ import { TableActionsComponent } from '../../../../shared/datatable/table-action import { CdTableAction } from '../../../../shared/models/cd-table-action'; import { CdTableSelection } from '../../../../shared/models/cd-table-selection'; import { OrchestratorFeature } from '../../../../shared/models/orchestrator.enum'; +import { OrchestratorStatus } from '../../../../shared/models/orchestrator.interface'; import { Permissions } from '../../../../shared/models/permissions'; import { AuthStorageService } from '../../../../shared/services/auth-storage.service'; import { SharedModule } from '../../../../shared/shared.module'; @@ -30,7 +31,7 @@ describe('InventoryDevicesComponent', () => { }; const mockOrchStatus = (available: boolean, features?: OrchestratorFeature[]) => { - const orchStatus = { available: available, description: '', features: {} }; + const orchStatus: OrchestratorStatus = { available: available, message: '', features: {} }; if (features) { features.forEach((feature: OrchestratorFeature) => { orchStatus.features[feature] = { available: true }; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/models/orchestrator.interface.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/models/orchestrator.interface.ts index feed4a88271d..4eceba8c0cac 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/models/orchestrator.interface.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/models/orchestrator.interface.ts @@ -1,6 +1,6 @@ export interface OrchestratorStatus { available: boolean; - description: string; + message: string; features: { [feature: string]: { available: boolean; diff --git a/src/pybind/mgr/dashboard/openapi.yaml b/src/pybind/mgr/dashboard/openapi.yaml index b4193a30b011..10e84e89c083 100644 --- a/src/pybind/mgr/dashboard/openapi.yaml +++ b/src/pybind/mgr/dashboard/openapi.yaml @@ -5048,12 +5048,12 @@ paths: available: description: Orchestrator status type: boolean - description: - description: Description + message: + description: Error message type: string required: - available - - description + - message type: object description: OK '400': diff --git a/src/pybind/mgr/dashboard/services/orchestrator.py b/src/pybind/mgr/dashboard/services/orchestrator.py index 16c038ada6e7..9e7d58a69bf3 100644 --- a/src/pybind/mgr/dashboard/services/orchestrator.py +++ b/src/pybind/mgr/dashboard/services/orchestrator.py @@ -23,13 +23,13 @@ class OrchestratorAPI(OrchestratorClientMixin): def status(self): try: - status, desc = super(OrchestratorAPI, self).available() - logger.info("is orchestrator available: %s, %s", status, desc) - return dict(available=status, description=desc) - except (RuntimeError, OrchestratorError, ImportError): + status, message = super().available() + logger.info("is orchestrator available: %s, %s", status, message) + return dict(available=status, message=message) + except (RuntimeError, OrchestratorError, ImportError) as e: return dict( available=False, - description='Orchestrator is unavailable for unknown reason') + message='Orchestrator is unavailable for unknown reason: {}'.format(str(e))) def orchestrator_wait(self, completions): return self._orchestrator_wait(completions) -- 2.47.3