diff --git a/changelogs/fragments/4901-fix-redfish-chassispower.yml b/changelogs/fragments/4901-fix-redfish-chassispower.yml new file mode 100644 index 0000000000..71a8b321eb --- /dev/null +++ b/changelogs/fragments/4901-fix-redfish-chassispower.yml @@ -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). diff --git a/plugins/module_utils/redfish_utils.py b/plugins/module_utils/redfish_utils.py index 5c7cff4a09..74d905a274 100644 --- a/plugins/module_utils/redfish_utils.py +++ b/plugins/module_utils/redfish_utils.py @@ -1883,14 +1883,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 = {}