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

Fix errors in hpe specific get methods (#7952)

* Fix errors in hpe specific get methods

* corrects reference to non existent `self.chassis_uri_list` to
  `self.chassis_uris`
* corrects syntactically incorrect dereferences
* removes an uneccessary variable assignment to `chassis_uri_list`
  in `get_psu_inventory` method
* adds changelog fragment for above indicating fix of issue #7951

* Update changelog.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Dave Rawks 2024-02-24 11:32:20 -08:00 committed by GitHub
parent 102a0857db
commit dd7c3ad10d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 15 deletions

View file

@ -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)."

View file

@ -2915,8 +2915,7 @@ class RedfishUtils(object):
# Get a list of all Chassis and build URIs, then get all PowerSupplies # Get a list of all Chassis and build URIs, then get all PowerSupplies
# from each Power entry in the Chassis # from each Power entry in the Chassis
chassis_uri_list = self.chassis_uris for chassis_uri in self.chassis_uris:
for chassis_uri in chassis_uri_list:
response = self.get_request(self.root_uri + chassis_uri) response = self.get_request(self.root_uri + chassis_uri)
if response['ret'] is False: if response['ret'] is False:
return response return response
@ -3508,33 +3507,30 @@ class RedfishUtils(object):
result = {} result = {}
key = "Thermal" key = "Thermal"
# Go through list # 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) response = self.get_request(self.root_uri + chassis_uri)
if response['ret'] is False: if response['ret'] is False:
return response return response
result['ret'] = True result['ret'] = True
data = response['data'] data = response['data']
oem = data.get['Oem'] val = data.get('Oem', {}).get('Hpe', {}).get('ThermalConfiguration')
hpe = oem.get['Hpe'] if val is not None:
thermal_config = hpe.get('ThermalConfiguration') return {"ret": True, "current_thermal_config": val}
result["current_thermal_config"] = thermal_config return {"ret": False}
return result
def get_hpe_fan_percent_min(self): def get_hpe_fan_percent_min(self):
result = {} result = {}
key = "Thermal" key = "Thermal"
# Go through list # 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) response = self.get_request(self.root_uri + chassis_uri)
if response['ret'] is False: if response['ret'] is False:
return response return response
result['ret'] = True
data = response['data'] data = response['data']
oem = data.get['Oem'] val = data.get('Oem', {}).get('Hpe', {}).get('FanPercentMinimum')
hpe = oem.get['Hpe'] if val is not None:
fan_percent_min_config = hpe.get('FanPercentMinimum') return {"ret": True, "fan_percent_min": val}
result["fan_percent_min"] = fan_percent_min_config return {"ret": False}
return result
def delete_volumes(self, storage_subsystem_id, volume_ids): def delete_volumes(self, storage_subsystem_id, volume_ids):
# Find the Storage resource from the requested ComputerSystem resource # Find the Storage resource from the requested ComputerSystem resource