renew exclusive status as part of login

This commit is contained in:
Tomas Kopecek 2022-11-28 14:32:07 +01:00
parent dcd009e593
commit 906958c814
2 changed files with 23 additions and 11 deletions

View file

@ -2498,8 +2498,11 @@ class ClientSession(object):
"""
# store calling parameters
self.auth_method = {'method': 'login', 'kwargs': {'opts': opts}}
sinfo = self.callMethod('login', self.opts['user'], self.opts['password'], opts=opts,
renew=renew)
kwargs = {'opts': opts}
if renew:
kwargs['renew'] = True
kwargs['exclusive'] = self.exclusive
sinfo = self.callMethod('login', self.opts['user'], self.opts['password'], **kwargs)
if not sinfo:
return False
self.setSession(sinfo)
@ -2575,7 +2578,10 @@ class ClientSession(object):
# will fail with a handshake failure, which is retried by default.
# For this case we're now using retry=False and test errors for
# this exact usecase.
kwargs = {'proxyuser': proxyuser, 'renew': renew}
kwargs = {'proxyuser': proxyuser}
if renew:
kwargs['renew'] = True
kwargs['exclusive'] = self.exclusive
if proxyauthtype is not None:
kwargs['proxyauthtype'] = proxyauthtype
for tries in range(self.opts.get('max_retries', 30)):
@ -2671,7 +2677,10 @@ class ClientSession(object):
self.opts['serverca'] = serverca
e_str = None
try:
kwargs = {'proxyuser': proxyuser, 'renew': renew}
kwargs = {'proxyuser': proxyuser}
if renew:
kwargs['renew'] = True
kwargs['exclusive'] = self.exclusive
if proxyauthtype is not None:
kwargs['proxyauthtype'] = proxyauthtype
sinfo = self._callMethod('sslLogin', [], kwargs)
@ -2903,8 +2912,6 @@ class ClientSession(object):
kwargs['renew'] = True
self.logged_in = False
auth_method(*args, **kwargs)
if self.exclusive:
self.exclusiveSession()
def renew_expired_session(func):
"""Decorator to renew expirated session or subsession."""