Skip to content

Commit

Permalink
Fix for get_volume_inventory (ansible-collections#6883)
Browse files Browse the repository at this point in the history
* Fix for get_volume_inventory

* Adding changelog fragment

* Update changelogs/fragments/6883-redfish-utils-changing-variable-names-in-get-volume-inventory.yml

---------

Co-authored-by: Kushal <t-s.kushal@hpe.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
  • Loading branch information
3 people authored and valeriopoggi committed Jul 17, 2023
1 parent 72ca4f8 commit e39bc0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- refish_utils module utils - changing variable names to avoid issues occuring when fetching Volumes data (https://github.com/ansible-collections/community.general/pull/6883).
16 changes: 8 additions & 8 deletions plugins/module_utils/redfish_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,19 +916,19 @@ def get_volume_inventory(self, systems_uri):
response = self.get_request(self.root_uri + data['Controllers'][u'@odata.id'])
if response['ret'] is False:
return response
data = response['data']
c_data = response['data']

if data.get('Members') and data['Members']:
response = self.get_request(self.root_uri + data['Members'][0][u'@odata.id'])
if c_data.get('Members') and c_data['Members']:
response = self.get_request(self.root_uri + c_data['Members'][0][u'@odata.id'])
if response['ret'] is False:
return response
data = response['data']
member_data = response['data']

if data:
if 'Name' in data:
controller_name = data['Name']
if member_data:
if 'Name' in member_data:
controller_name = member_data['Name']
else:
controller_id = data.get('Id', '1')
controller_id = member_data.get('Id', '1')
controller_name = 'Controller %s' % controller_id
volume_results = []
volume_list = []
Expand Down

0 comments on commit e39bc0a

Please sign in to comment.