summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-01-22 11:21:34 -0700
committerRob Crittenden <rcritten@redhat.com>2009-02-03 15:29:00 -0500
commit46c10d4608508de01a65d6e6076104d88c63b253 (patch)
treed769ee7ba84c6dff4cfee0f034f6cfa627389d8e /ipalib/cli.py
parent12c4879613f51c90239be749a777f480310b1318 (diff)
downloadfreeipa-46c10d4608508de01a65d6e6076104d88c63b253.tar.gz
freeipa-46c10d4608508de01a65d6e6076104d88c63b253.tar.xz
freeipa-46c10d4608508de01a65d6e6076104d88c63b253.zip
Removed bogus CLI.set_defaults() method that was causing non-required values to get filled in
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 9eb3c0920..809c0e551 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -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: