mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Removed bogus CLI.set_defaults() method that was causing non-required values to get filled in
This commit is contained in:
parent
12c4879613
commit
46c10d4608
@ -696,7 +696,6 @@ class CLI(object):
|
||||
if self.options.interactive:
|
||||
self.prompt_interactively(cmd, kw)
|
||||
self.prompt_for_passwords(cmd, kw)
|
||||
self.set_defaults(cmd, kw)
|
||||
result = cmd(**kw)
|
||||
if callable(cmd.output_for_cli):
|
||||
for param in cmd.params():
|
||||
@ -708,16 +707,9 @@ class CLI(object):
|
||||
(args, options) = cmd.params_2_args_options(**kw)
|
||||
cmd.output_for_cli(self.api.Backend.textui, result, *args, **options)
|
||||
|
||||
def set_defaults(self, cmd, kw):
|
||||
for param in cmd.params():
|
||||
if not kw.get(param.name):
|
||||
value = param.get_default(**kw)
|
||||
if value:
|
||||
kw[param.name] = value
|
||||
|
||||
def prompt_for_passwords(self, cmd, kw):
|
||||
for param in cmd.params():
|
||||
if 'password' not in param.flags:
|
||||
if not isinstance(param, Password):
|
||||
continue
|
||||
if kw.get(param.name, False) is True or param.name in cmd.args:
|
||||
kw[param.name] = self.textui.prompt_password(
|
||||
@ -738,11 +730,12 @@ class CLI(object):
|
||||
optional.
|
||||
"""
|
||||
for param in cmd.params():
|
||||
if 'password' in param.flags:
|
||||
if isinstance(param, Password):
|
||||
continue
|
||||
elif param.name not in kw:
|
||||
if not (param.required or self.options.prompt_all):
|
||||
if not param.required and not self.options.prompt_all:
|
||||
continue
|
||||
print 'prompting for %r' % param.name
|
||||
default = param.get_default(**kw)
|
||||
error = None
|
||||
while True:
|
||||
@ -758,6 +751,7 @@ class CLI(object):
|
||||
error = e.error
|
||||
return kw
|
||||
|
||||
|
||||
# FIXME: This should be done as the plugins are loaded
|
||||
# if self.api.env.server_context:
|
||||
# try:
|
||||
|
@ -96,6 +96,7 @@ class Command(plugable.Plugin):
|
||||
If not in a server context, the call will be forwarded over
|
||||
XML-RPC and the executed an the nearest IPA server.
|
||||
"""
|
||||
self.debug(make_repr(self.name, *args, **options))
|
||||
params = self.args_options_2_params(*args, **options)
|
||||
params = self.normalize(**params)
|
||||
params = self.convert(**params)
|
||||
|
@ -217,7 +217,7 @@ class user_del(crud.Delete):
|
||||
api.register(user_del)
|
||||
|
||||
|
||||
class user_mod(crud.Mod):
|
||||
class user_mod(crud.Update):
|
||||
'Edit an existing user.'
|
||||
def execute(self, uid, **kw):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user