From a54a9a5d099576a23e7168c2e9c2ac7e9a82c0a2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 27 Jun 2022 14:34:37 -0400 Subject: [PATCH] Enable ipmi user if required If redfish models ipmi as an account type, and user wants ipmi, add it to the account. --- .../confluent/discovery/handlers/xcc.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/confluent_server/confluent/discovery/handlers/xcc.py b/confluent_server/confluent/discovery/handlers/xcc.py index 32c9306f..5c236b03 100644 --- a/confluent_server/confluent/discovery/handlers/xcc.py +++ b/confluent_server/confluent/discovery/handlers/xcc.py @@ -536,6 +536,20 @@ class NodeHandler(immhandler.NodeHandler): _, _ = nwc.grab_json_response_with_status( '/redfish/v1/Managers/1/NetworkProtocol', {'IPMI': {'ProtocolEnabled': True}}, method='PATCH') + rsp, status = nwc.grab_json_response_with_status( + '/redfish/v1/AccountService/Accounts/1') + if status == 200: + allowable = rsp.get('AccountTypes@Redfish.AllowableValues', []) + current = rsp.get('AccountTypes', []) + if 'IPMI' in allowable and 'IPMI' not in current: + current.append('IPMI') + updateinf = { + 'AccountTypes': current, + 'Password': self._currcreds[1] + } + rsp, status = nwc.grab_json_response_with_status( + '/redfish/v1/AccountService/Accounts/1', + updateinf, method='PATCH') if ('hardwaremanagement.manager' in cd and cd['hardwaremanagement.manager']['value'] and not cd['hardwaremanagement.manager']['value'].startswith(