1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-24 05:46:13 +01:00

Merge pull request #1420 from dmach/fix-loading-password-from-keyring

Fix loading password from keyring
This commit is contained in:
Daniel Mach 2023-10-04 08:48:48 +02:00 committed by GitHub
commit 11c2140ad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1824,17 +1824,17 @@ def get_config(override_conffile=None,
for name, field in host_options.__fields__.items():
ini_key = field.extra.get("ini_key", name)
if ini_key in cp[url]:
value = cp[url][ini_key]
else:
continue
if name == "password":
# we need to handle the password first because it may be stored in a keyring instead of a config file
creds_mgr = _get_credentials_manager(url, cp)
value = creds_mgr.get_password(url, host_options.username, defer=True, apiurl=host_options.apiurl)
if value is None:
raise oscerr.ConfigMissingCredentialsError("No password found in section {url}", conffile, url)
value = Password(value)
elif ini_key in cp[url]:
value = cp[url][ini_key]
else:
continue
host_options.set_value_from_string(name, value)