diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-12-20 15:00:00 -0700 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-12-20 15:00:00 -0700 |
commit | 6fdf5d1e7bb2171646e17cac835be54a4104b5ac (patch) | |
tree | 85c084784809b3592d109a116792a0621130146f /ipalib/cli.py | |
parent | 9a69adeef001ddd0c55513271cf02eedc0a9aef8 (diff) | |
parent | c025ed6404e147f19b71b398e920fd1b3a05452a (diff) | |
download | freeipa-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.py | 13 |
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: |