1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix GetChassisPower when multiple chassis are present (#4902) (#4914)

* Fix GetChassisPower when multiple chassis are present

When multiple chassis are present, and one or more of those chassis do _not_
report power information, the GetChassisPower command will fail. To address
that, only report a failure if _all_ of the Chassis objects lack power
power reporting functionality.

Fixes #4901

* Update changelogs/fragments/4901-fix-redfish-chassispower.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f60d12cf2d)

Co-authored-by: Jacob Yundt <jyundt@gmail.com>
This commit is contained in:
patchback[bot] 2022-06-30 21:01:40 +02:00 committed by GitHub
parent bf42b48d5d
commit 96c80fe478
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- redfish_info - fix to ``GetChassisPower`` to correctly report power information when multiple chassis exist, but not all chassis report power information (https://github.com/ansible-collections/community.general/issues/4901).

View file

@ -1883,14 +1883,13 @@ class RedfishUtils(object):
for property in properties: for property in properties:
if property in data: if property in data:
chassis_power_result[property] = data[property] chassis_power_result[property] = data[property]
else:
return {'ret': False, 'msg': 'Key PowerControl not found.'}
chassis_power_results.append(chassis_power_result) chassis_power_results.append(chassis_power_result)
else:
return {'ret': False, 'msg': 'Key Power not found.'}
result['entries'] = chassis_power_results if len(chassis_power_results) > 0:
return result result['entries'] = chassis_power_results
return result
else:
return {'ret': False, 'msg': 'Power information not found.'}
def get_chassis_thermals(self): def get_chassis_thermals(self):
result = {} result = {}