1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02:00

Add support for changing the password store via osc config

The password store can be changed (without entering the password
again) via "osc config <apiurl> --select-password-store". This
command deletes the password from the current password store and
stores it in the selected password store.

Previously, the --select-password-store option had no meaningful
semantics. In order to use it, one always had to provide a password
and explicitly pass "pass" as the config option (the same could be
achieved by using --change-password). Hence, in a strict sense,
this change breaks the UI.
This commit is contained in:
Marcus Huewe 2021-07-14 11:19:08 +02:00
parent dfdf07b228
commit 7e23743239
2 changed files with 12 additions and 0 deletions

View File

@ -9206,6 +9206,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if len(args) != 1:
raise oscerr.WrongArgs('--change-password only needs the apiurl')
args = [args[0], 'pass']
elif opts.select_password_store:
if len(args) != 1:
raise oscerr.WrongArgs('--select-password-store only needs the apiurl')
args = [args[0], 'pass']
if len(args) < 2 and not (opts.dump or opts.dump_full):
raise oscerr.WrongArgs('Too few arguments')
elif opts.dump or opts.dump_full:

View File

@ -726,6 +726,13 @@ def config_set_option(section, opt, val=None, delete=False, update=True, creds_m
if section == 'general' and not opt in general_opts or \
section != 'general' and not opt in api_host_options:
raise oscerr.ConfigError('unknown config option \'%s\'' % opt, config['conffile'])
if not val and not delete and opt == 'pass' and creds_mgr_descr is not None:
# change password store
creds_mgr = _get_credentials_manager(section, cp)
user = _extract_user_compat(cp, section, creds_mgr)
val = creds_mgr.get_password(section, user)
run = False
if val:
if opt == 'pass':