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

redfish_utils: fix reference to local variable 'systems_service' (#50298)

* fixes issue 50296

* fixes the indentation of the return statement

* Adds a conditional test into `_find_systems_resource()` to check the existence
of the Members of System resource

* updates the error message

* harden the conditional test

* Add a changelog
This commit is contained in:
Dhanuka 2019-01-11 19:46:20 +05:30 committed by John R Barker
parent 1ae365c112
commit 94a1d86d70
2 changed files with 11 additions and 4 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- redfish_utils - fix reference to local variable 'systems_service'

View file

@ -133,10 +133,14 @@ class RedfishUtils(object):
if response['ret'] is False: if response['ret'] is False:
return response return response
data = response['data'] data = response['data']
for member in data[u'Members']: if data.get(u'Members'):
systems_service = member[u'@odata.id'] for member in data[u'Members']:
self.systems_uri = systems_service systems_service = member[u'@odata.id']
return {'ret': True} self.systems_uri = systems_service
return {'ret': True}
else:
return {'ret': False,
'msg': "ComputerSystem's Members array is either empty or missing"}
def _find_updateservice_resource(self, uri): def _find_updateservice_resource(self, uri):
response = self.get_request(self.root_uri + uri) response = self.get_request(self.root_uri + uri)