Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #7952/dd7c3ad1 backport][stable-7] Fix errors in hpe specific get methods #8021

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/7951-fix-redfish_info-exception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "redfish_info - correct uncaught exception when attempting to retrieve ``Chassis`` information (https://github.com/ansible-collections/community.general/pull/7952)."
26 changes: 11 additions & 15 deletions plugins/module_utils/redfish_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2915,8 +2915,7 @@ def get_psu_inventory(self):

# Get a list of all Chassis and build URIs, then get all PowerSupplies
# from each Power entry in the Chassis
chassis_uri_list = self.chassis_uris
for chassis_uri in chassis_uri_list:
for chassis_uri in self.chassis_uris:
response = self.get_request(self.root_uri + chassis_uri)
if response['ret'] is False:
return response
Expand Down Expand Up @@ -3478,33 +3477,30 @@ def get_hpe_thermal_config(self):
result = {}
key = "Thermal"
# Go through list
for chassis_uri in self.chassis_uri_list:
for chassis_uri in self.chassis_uris:
response = self.get_request(self.root_uri + chassis_uri)
if response['ret'] is False:
return response
result['ret'] = True
data = response['data']
oem = data.get['Oem']
hpe = oem.get['Hpe']
thermal_config = hpe.get('ThermalConfiguration')
result["current_thermal_config"] = thermal_config
return result
val = data.get('Oem', {}).get('Hpe', {}).get('ThermalConfiguration')
if val is not None:
return {"ret": True, "current_thermal_config": val}
return {"ret": False}

def get_hpe_fan_percent_min(self):
result = {}
key = "Thermal"
# Go through list
for chassis_uri in self.chassis_uri_list:
for chassis_uri in self.chassis_uris:
response = self.get_request(self.root_uri + chassis_uri)
if response['ret'] is False:
return response
result['ret'] = True
data = response['data']
oem = data.get['Oem']
hpe = oem.get['Hpe']
fan_percent_min_config = hpe.get('FanPercentMinimum')
result["fan_percent_min"] = fan_percent_min_config
return result
val = data.get('Oem', {}).get('Hpe', {}).get('FanPercentMinimum')
if val is not None:
return {"ret": True, "fan_percent_min": val}
return {"ret": False}

def delete_volumes(self, storage_subsystem_id, volume_ids):
# Find the Storage resource from the requested ComputerSystem resource
Expand Down