2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-27 19:37:57 +00:00

Fix loss of web connectivity during XCC discovery

The password policy was incorrectly logging out in the
middle of the flow when a forced password change occurred.
Fix by externally managing the web session.
This commit is contained in:
Jarrod Johnson 2020-02-26 10:00:10 -05:00
parent e2d0e49fc7
commit 3c26beda1d

View File

@ -175,7 +175,8 @@ class NodeHandler(immhandler.NodeHandler):
if pwdchanged:
# Remove the minimum change interval, to allow sane
# password changes after provisional changes
self.set_password_policy('')
wc = self.wc
self.set_password_policy('', wc)
return (wc, pwdchanged)
return (None, None)
@ -233,7 +234,7 @@ class NodeHandler(immhandler.NodeHandler):
if wc:
return wc
def set_password_policy(self, strruleset):
def set_password_policy(self, strruleset, wc):
ruleset = {'USER_GlobalMinPassChgInt': '0'}
for rule in strruleset.split(','):
if '=' not in rule:
@ -254,9 +255,7 @@ class NodeHandler(immhandler.NodeHandler):
if name.lower() == 'reuse':
ruleset['USER_GlobalMinPassReuseCycle'] = value
try:
wc = self.wc
wc.grab_json_response('/api/dataset', ruleset)
wc.grab_json_response('/api/providers/logout')
except Exception as e:
print(repr(e))
pass
@ -364,7 +363,7 @@ class NodeHandler(immhandler.NodeHandler):
self.nodename, ['secret.hardwaremanagementuser',
'secret.hardwaremanagementpassword'], decrypt=True)
user, passwd, isdefault = self.get_node_credentials(nodename, creds, 'USERID', 'PASSW0RD')
self.set_password_policy(strruleset)
self.set_password_policy(strruleset, wc)
if self._atdefaultcreds:
if isdefault and self.tmppasswd:
raise Exception(