diff options
-rw-r--r-- | ipalib/cli.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index af3eb6e35..ca3364aef 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -687,6 +687,7 @@ 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(): @@ -698,6 +699,13 @@ 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: |