2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 01:22:00 +00:00

Enable ipmi user if required

If redfish models ipmi as an account type, and user wants ipmi, add it to the account.
This commit is contained in:
Jarrod Johnson 2022-06-27 14:34:37 -04:00
parent 29965f6ec9
commit 500e083746

View File

@ -534,6 +534,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(