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

Fix retrieving the configured user in 'user' command

Testing if 'user' config value is present is not necessary,
because the 'username' field is mandatory in HostOptions
and there is also a check that prompts user to enter new credentials if
user is not set.
This commit is contained in:
Daniel Mach 2023-10-13 19:16:36 +02:00
parent 2aa7c17331
commit 9067a803cc

View File

@ -9113,12 +9113,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"""
Show fullname and email of a buildservice user
"""
usernames = opts.user
apiurl = self.get_api_url()
if len(usernames) < 1:
if 'user' not in conf.config['api_host_options'][apiurl]:
raise oscerr.WrongArgs('your oscrc does not have your user name.')
usernames = (conf.config['api_host_options'][apiurl]['user'],)
usernames = opts.user
if not usernames:
usernames = [conf.config["api_host_options"][apiurl]["user"]]
for name in usernames:
user = get_user_data(apiurl, name, 'login', 'realname', 'email')
if len(user) == 3: