summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-12-20 15:00:00 -0700
committerJason Gerard DeRose <jderose@redhat.com>2008-12-20 15:00:00 -0700
commit6fdf5d1e7bb2171646e17cac835be54a4104b5ac (patch)
tree85c084784809b3592d109a116792a0621130146f /ipalib/cli.py
parent9a69adeef001ddd0c55513271cf02eedc0a9aef8 (diff)
parentc025ed6404e147f19b71b398e920fd1b3a05452a (diff)
downloadfreeipa-6fdf5d1e7bb2171646e17cac835be54a4104b5ac.tar.gz
freeipa-6fdf5d1e7bb2171646e17cac835be54a4104b5ac.tar.xz
freeipa-6fdf5d1e7bb2171646e17cac835be54a4104b5ac.zip
Merge branch 'master' of git://git.engineering.redhat.com/users/rcritten/freeipa2
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 0bab952bf..518b71298 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -697,14 +697,25 @@ 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():
if param.ispassword():
- del kw[param.name]
+ try:
+ del kw[param.name]
+ except KeyError:
+ pass
(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: