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)

* 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>
This commit is contained in:
Jacob Yundt 2022-06-30 14:36:01 -04:00 committed by GitHub
parent 93dcd3f54d
commit f60d12cf2d
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

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