From cf5007d478d0d90b487654373572ceb30d8178a8 Mon Sep 17 00:00:00 2001 From: Jakob Meng Date: Mon, 2 May 2022 11:44:36 +0200 Subject: [PATCH] Fixed return value disable{d,s}_reason in compute_service_info module OpenStack SDK 0.53 renamed parameter disables_reason to disabled_reason in openstack/compute/v2/service.py, hence our compute_service_info module will return different values depending on which release of the OpenStack SDK is used. Ref.: https://github.com/openstack/openstacksdk/commit/5450c4525313581b2ebc0e1ab6ac6252964c595f Change-Id: I1c0f787f7f67c92f92dd106fc8d55580461e4aa3 --- ci/roles/nova_services/tasks/main.yml | 11 ++++++++++- plugins/modules/compute_service_info.py | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ci/roles/nova_services/tasks/main.yml b/ci/roles/nova_services/tasks/main.yml index 37c3459d..60e244d2 100644 --- a/ci/roles/nova_services/tasks/main.yml +++ b/ci/roles/nova_services/tasks/main.yml @@ -6,7 +6,16 @@ register: result failed_when: "result.openstack_compute_services | length <= 0" -- name: Assert fields +- name: Assert fields on OpenStack SDK before 0.53 + when: sdk_version is version(0.53, '<') + assert: + that: + - '["availability_zone", "binary", "disables_reason", "is_forced_down", + "host", "name", "state", "status", "updated_at", "id"] | + difference(result.openstack_compute_services.0.keys()) | length == 0' + +- name: Assert fields on OpenStack SDK 0.53 and later + when: sdk_version is version(0.53, '>=') assert: that: - '["availability_zone", "binary", "disabled_reason", "is_forced_down", diff --git a/plugins/modules/compute_service_info.py b/plugins/modules/compute_service_info.py index 427843b3..03ebf534 100644 --- a/plugins/modules/compute_service_info.py +++ b/plugins/modules/compute_service_info.py @@ -61,7 +61,11 @@ openstack_compute_services: type: str disabled_reason: description: The reason why the service is disabled - returned: success + returned: success and OpenStack SDK >= 0.53 + type: str + disables_reason: + description: The reason why the service is disabled + returned: success and OpenStack SDK < 0.53 type: str availability_zone: description: The availability zone name.