From 1359618e7ee335b0721fbcd9705608ef09158e3b Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 26 Feb 2009 15:27:06 -0700 Subject: Fixed broken autfill logic in cli.prompt_interactively() --- ipalib/cli.py | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'ipalib') diff --git a/ipalib/cli.py b/ipalib/cli.py index c1d5ea0e1..6bacd5027 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -611,26 +611,28 @@ class cli(backend.Executioner): params that have a missing values, even if the param is optional. """ for param in cmd.params(): - if param.password: - if kw.get(param.name, False) is True or param.name in cmd.args: - kw[param.name] = \ - self.Backend.textui.prompt_password(param.cli_name) - elif param.autofill or param.name in kw: - continue - elif param.required or self.env.prompt_all: - default = param.get_default(**kw) - error = None - while True: - if error is not None: - print '>>> %s: %s' % (param.cli_name, error) - raw = self.Backend.textui.prompt(param.cli_name, default) - try: - value = param(raw, **kw) - if value is not None: - kw[param.name] = value - break - except errors.ValidationError, e: - error = e.error + if param.password and ( + kw.get(param.name, False) is True or param.name in cmd.args + ): + kw[param.name] = \ + self.Backend.textui.prompt_password(param.cli_name) + elif param.name not in kw: + if param.autofill: + kw[param.name] = param.get_default(**kw) + elif param.required or self.env.prompt_all: + default = param.get_default(**kw) + error = None + while True: + if error is not None: + print '>>> %s: %s' % (param.cli_name, error) + raw = self.Backend.textui.prompt(param.cli_name, default) + try: + value = param(raw, **kw) + if value is not None: + kw[param.name] = value + break + except errors.ValidationError, e: + error = e.error cli_plugins = ( -- cgit