From 4bf051b8bb3877f95ce1c807000aec1b2929aee0 Mon Sep 17 00:00:00 2001 From: Mike Garrett Date: Wed, 12 Jun 2019 13:40:30 -0500 Subject: [PATCH] redfish: fix a problem with Chassis/Power URI (#56185) Fixes #56137 - problem with Chassis/Power URI and GetChassisPower command - assemble URI from data in Chassis resource --- .../fragments/56185-problem-with-redfish-chassis-power-uri.yml | 2 ++ lib/ansible/module_utils/redfish_utils.py | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/56185-problem-with-redfish-chassis-power-uri.yml diff --git a/changelogs/fragments/56185-problem-with-redfish-chassis-power-uri.yml b/changelogs/fragments/56185-problem-with-redfish-chassis-power-uri.yml new file mode 100644 index 00000000000..9ae127587e8 --- /dev/null +++ b/changelogs/fragments/56185-problem-with-redfish-chassis-power-uri.yml @@ -0,0 +1,2 @@ +bugfixes: + - Redfish - Instead of building the Power URI from assumptions about URI structure, assemble from @odata.id information in the Chassis resource (https://github.com/ansible/ansible/issues/56137). diff --git a/lib/ansible/module_utils/redfish_utils.py b/lib/ansible/module_utils/redfish_utils.py index 5da72747659..9a1c85cbd0e 100644 --- a/lib/ansible/module_utils/redfish_utils.py +++ b/lib/ansible/module_utils/redfish_utils.py @@ -1195,8 +1195,7 @@ class RedfishUtils(object): result['ret'] = True data = response['data'] if key in data: - response = self.get_request(self.root_uri + chassis_uri + - "/" + key) + response = self.get_request(self.root_uri + data[key]['@odata.id']) data = response['data'] if 'PowerControl' in data: if len(data['PowerControl']) > 0: