From fe2a8cb1450edd568f238d9fe71c49e067e84395 Mon Sep 17 00:00:00 2001 From: Bill Dodd Date: Sat, 15 Feb 2020 06:49:18 -0600 Subject: [PATCH] do not loop through chassis in manage_indicator_led() (#66044) --- lib/ansible/module_utils/redfish_utils.py | 27 +++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/lib/ansible/module_utils/redfish_utils.py b/lib/ansible/module_utils/redfish_utils.py index efd8def2959..1b329146e4e 100644 --- a/lib/ansible/module_utils/redfish_utils.py +++ b/lib/ansible/module_utils/redfish_utils.py @@ -702,22 +702,21 @@ class RedfishUtils(object): 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