From 93b7547c5860360ab3079a25dfa188a5806c12b3 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 24 Aug 2022 10:13:53 -0400 Subject: [PATCH] Enable IPMI for user if IPMI has been enabled globally elsewhere Scenarios have come up with trying to repair partially configured configuration, break the global and per-account check into separate concerns. --- .../confluent/discovery/handlers/xcc.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/confluent_server/confluent/discovery/handlers/xcc.py b/confluent_server/confluent/discovery/handlers/xcc.py index 7850f63b..2061b15b 100644 --- a/confluent_server/confluent/discovery/handlers/xcc.py +++ b/confluent_server/confluent/discovery/handlers/xcc.py @@ -558,20 +558,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') + 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(