summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-02-26 15:27:06 -0700
committerRob Crittenden <rcritten@redhat.com>2009-02-27 12:58:32 -0500
commit1359618e7ee335b0721fbcd9705608ef09158e3b (patch)
tree458ebd361d2866ce187fe535f8f376ac129630b9 /ipalib
parent3fdf9abfce71e0d32f6fc8e5a3b699b663fc5ead (diff)
downloadfreeipa-1359618e7ee335b0721fbcd9705608ef09158e3b.tar.gz
freeipa-1359618e7ee335b0721fbcd9705608ef09158e3b.tar.xz
freeipa-1359618e7ee335b0721fbcd9705608ef09158e3b.zip
Fixed broken autfill logic in cli.prompt_interactively()
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py42
1 files changed, 22 insertions, 20 deletions
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 = (