1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 09:26:14 +01:00

Ask for new credentials when user is missing from an apiurl section in the config file

This commit is contained in:
Daniel Mach 2023-10-10 16:13:05 +02:00
parent 0dd89bb3a0
commit 61b5f7bebc

View File

@ -1833,7 +1833,9 @@ def get_config(override_conffile=None,
urls = [i for i in cp.sections() if i != "general"]
for url in urls:
apiurl = sanitize_apiurl(url)
username = cp[url]["user"]
username = cp[url].get("user", None)
if username is None:
raise oscerr.ConfigMissingCredentialsError(f"No user found in section {url}", conffile, url)
host_options = HostOptions(apiurl=apiurl, username=username, _parent=config)
for name, field in host_options.__fields__.items():