mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Add IndicatorLED control commands to redfish_command module (#53752)
* Add Chassis commands IndicatorLedOn, IndicatorLedOff, and IndicatorLedBlink * Add manage_indicator_led function to redfish_utils * Add Chassis command category with IndicatorLedOn/Off/Blink commands to redfish_command * Add IndicatorLedBlink example to EXAMPLES docstring, and make the category == 'Chassis' section more generic for future development
This commit is contained in:
committed by
John R Barker
parent
eebebb1a83
commit
31b02fdd58
@@ -438,6 +438,32 @@ class RedfishUtils(object):
|
||||
return response
|
||||
return {'ret': True}
|
||||
|
||||
def manage_indicator_led(self, command):
|
||||
result = {}
|
||||
key = 'IndicatorLED'
|
||||
|
||||
payloads = {'IndicatorLedOn': 'Lit', 'IndicatorLedOff': 'Off', "IndicatorLedBlink": 'Blinking'}
|
||||
|
||||
result = {}
|
||||
for chassis_uri in self.chassis_uri_list:
|
||||
response = self.get_request(self.root_uri + 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 + chassis_uri, payload, HEADERS)
|
||||
if response['ret'] is False:
|
||||
return response
|
||||
else:
|
||||
return {'ret': False, 'msg': 'Invalid command'}
|
||||
|
||||
return result
|
||||
|
||||
def manage_system_power(self, command):
|
||||
result = {}
|
||||
key = "Actions"
|
||||
|
||||
Reference in New Issue
Block a user