From 29965f6ec9f1d5603cd4be2152e36494a0f6222e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 27 Jun 2022 14:12:51 -0400 Subject: [PATCH] Add a catch all to redfish for xcc Newer xcc changes things yet again, but we are comfortably in the firmware that can be bootstrapped with redfish, so use that instead once we've cleared the redfish incapable variants. --- .../confluent/discovery/handlers/xcc.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/confluent_server/confluent/discovery/handlers/xcc.py b/confluent_server/confluent/discovery/handlers/xcc.py index a4723e31..1da1af58 100644 --- a/confluent_server/confluent/discovery/handlers/xcc.py +++ b/confluent_server/confluent/discovery/handlers/xcc.py @@ -409,7 +409,21 @@ class NodeHandler(immhandler.NodeHandler): rsp, status = wc.grab_json_response_with_status( '/api/function', {'USER_UserModify': '{0},{1},,1,4,0,0,0,0,,8,,,'.format(uid, username)}) + if status == 200 and rsp.get('return', 0) == 13: + wc.set_basic_credentials(self._currcreds[0], self._currcreds[1]) + status = 503 + while status != 200: + rsp, status = wc.grab_json_response_with_status( + '/redfish/v1/AccountService/Accounts/{0}'.format(uid), + {'UserName': username}, method='PATCH') + if status != 200: + rsp = json.loads(rsp) + if rsp.get('error', {}).get('code', 'Unknown') in ('Base.1.8.GeneralError', 'Base.1.12.GeneralError'): + eventlet.sleep(10) + else: + break self.tmppasswd = None + wc.grab_json_response('/api/providers/logout') self._currcreds = (username, passwd) def _convert_sha256account(self, user, passwd, wc): @@ -501,6 +515,7 @@ class NodeHandler(immhandler.NodeHandler): 'Request to use default credentials, but refused by target after it has been changed to {0}'.format(self.tmppasswd)) if not isdefault: self._setup_xcc_account(user, passwd, wc) + wc = self.wc self._convert_sha256account(user, passwd, wc) cd = self.configmanager.get_node_attributes( nodename, ['secret.hardwaremanagementuser',