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:
parent
93dcd3f54d
commit
f60d12cf2d
2 changed files with 7 additions and 6 deletions
2
changelogs/fragments/4901-fix-redfish-chassispower.yml
Normal file
2
changelogs/fragments/4901-fix-redfish-chassispower.yml
Normal 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).
|
|
@ -1888,14 +1888,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 = {}
|
||||||
|
|
Loading…
Reference in a new issue