summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2012-01-16 09:21:50 -0500
committerMartin Kosek <mkosek@redhat.com>2012-03-28 14:03:27 +0200
commit5a55e11a2540b9fa7c0af04b375d9bdaf277642d (patch)
tree35bf773c74325ab2da55d8bb8b94bf0fd11d6536 /ipalib/cli.py
parent9bb1e6c03edf917178f2e1bdf395735e1b17ad1f (diff)
downloadfreeipa-5a55e11a2540b9fa7c0af04b375d9bdaf277642d.tar.gz
freeipa-5a55e11a2540b9fa7c0af04b375d9bdaf277642d.tar.xz
freeipa-5a55e11a2540b9fa7c0af04b375d9bdaf277642d.zip
Fix the procedure for getting default values of command parameters.
The parameters used in default_from of other parameters are now properly validated before the default_from is called. ticket 1847
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index ea320cf65..f72cca587 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -48,7 +48,7 @@ import plugable
import util
from errors import (PublicError, CommandError, HelpError, InternalError,
NoSuchNamespaceError, ValidationError, NotFound, NotConfiguredError,
- PromptFailed)
+ PromptFailed, ConversionError)
from constants import CLI_TAB
from parameters import Password, Bytes, File, Str, StrEnum
from text import _
@@ -1152,7 +1152,7 @@ class cli(backend.Executioner):
if (param.required and param.name not in kw) or \
(param.alwaysask and honor_alwaysask) or self.env.prompt_all:
if param.autofill:
- kw[param.name] = param.get_default(**kw)
+ kw[param.name] = cmd.get_default_of(param.name, **kw)
if param.name in kw and kw[param.name] is not None:
continue
if param.password:
@@ -1160,7 +1160,7 @@ class cli(backend.Executioner):
param.label, param.confirm
)
else:
- default = param.get_default(**kw)
+ default = cmd.get_default_of(param.name, **kw)
error = None
while True:
if error is not None:
@@ -1172,7 +1172,7 @@ class cli(backend.Executioner):
if value is not None:
kw[param.name] = value
break
- except ValidationError, e:
+ except (ValidationError, ConversionError), e:
error = e.error
elif param.password and kw.get(param.name, False) is True:
kw[param.name] = self.Backend.textui.prompt_password(