mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-24 22:06:14 +01:00
Merge branch 'config_select_password_store' of https://github.com/marcus-h/osc
Add support for changing the password store via "osc config" + a small bugfix in the "osc config -d <apiurl> pass" codepath.
This commit is contained in:
commit
6b83134377
@ -9207,6 +9207,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:
|
||||
|
@ -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':
|
||||
@ -755,7 +762,7 @@ def config_set_option(section, opt, val=None, delete=False, update=True, creds_m
|
||||
elif delete and (cp.has_option(section, opt) or opt == 'pass'):
|
||||
if opt == 'pass':
|
||||
creds_mgr = _get_credentials_manager(section, cp)
|
||||
user = _extract_user_compar(cp, section, creds_mgr)
|
||||
user = _extract_user_compat(cp, section, creds_mgr)
|
||||
creds_mgr.delete_password(section, user)
|
||||
else:
|
||||
cp.remove_option(section, opt)
|
||||
|
Loading…
Reference in New Issue
Block a user