1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

Merge pull request #1028 from marcus-h/lazy_password_callable_fix

Handle a callable in credentials._LazyPassword.__str__
This commit is contained in:
Marco Strigl 2022-04-14 10:33:53 +02:00 committed by GitHub
commit bc9869bdc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,9 +40,14 @@ class _LazyPassword(object):
def __str__(self):
if self._password is None:
self._password = self._pwfunc()
if self._password is None:
password = self._pwfunc()
if callable(password):
print('Warning: use of a deprecated credentials manager API.',
file=sys.stderr)
password = password()
if password is None:
raise oscerr.OscIOError(None, 'Unable to retrieve password')
self._password = password
return self._password
def __len__(self):