Skip to content

Commit

Permalink
do not loop through chassis in manage_indicator_led() (ansible#66044)
Browse files Browse the repository at this point in the history
  • Loading branch information
billdodd authored Feb 15, 2020
1 parent 936bd83 commit fe2a8cb
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions lib/ansible/module_utils/redfish_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,22 +702,21 @@ def manage_indicator_led(self, command):
payloads = {'IndicatorLedOn': 'Lit', 'IndicatorLedOff': 'Off', "IndicatorLedBlink": 'Blinking'}

result = {}
for chassis_uri in self.chassis_uris:
response = self.get_request(self.root_uri + chassis_uri)
response = self.get_request(self.root_uri + self.chassis_uri)
if response['ret'] is False:
return response
result['ret'] = True
data = response['data']
if key not in data:
return {'ret': False, 'msg': "Key %s not found" % key}

if command in payloads.keys():
payload = {'IndicatorLED': payloads[command]}
response = self.patch_request(self.root_uri + self.chassis_uri, payload)
if response['ret'] is False:
return response
result['ret'] = True
data = response['data']
if key not in data:
return {'ret': False, 'msg': "Key %s not found" % key}

if command in payloads.keys():
payload = {'IndicatorLED': payloads[command]}
response = self.patch_request(self.root_uri + chassis_uri, payload)
if response['ret'] is False:
return response
else:
return {'ret': False, 'msg': 'Invalid command'}
else:
return {'ret': False, 'msg': 'Invalid command'}

return result

Expand Down

0 comments on commit fe2a8cb

Please sign in to comment.