summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-02-28 15:04:05 +0100
committerRob Crittenden <rcritten@redhat.com>2012-03-01 22:12:25 -0500
commit1d09cdf6342cfd715c366e881ced1d1f22d1503a (patch)
tree6ee8232dfd3656a5951f3529562448ba99c1ab1b /ipalib/cli.py
parent640dee7caad4a1bf7c05bb539f0e6655fe758a54 (diff)
downloadfreeipa-1d09cdf6342cfd715c366e881ced1d1f22d1503a.tar.gz
freeipa-1d09cdf6342cfd715c366e881ced1d1f22d1503a.tar.xz
freeipa-1d09cdf6342cfd715c366e881ced1d1f22d1503a.zip
Improve dnsrecord interactive help
Add 2 new features to DNS record interactive help to increase its usability and also make its behavior more consistent with standard parameter interactive help: 1) Ask for missing DNS parts When a required part of a newly added DNS record was missing, we just returned a ValidationError. Now, the interactive help rather asks for all missing required parts of all DNS records that were being added by its parts. 2) Let user amend invalid part When an interactive help asked for a DNS record part value and user enters an invalid value, the entire interactive help exits with an error. This may upset a user if he already entered several correct DNS record part values. Now, the help rather tells user what's wrong and give him an opportunity to amend the value. https://fedorahosted.org/freeipa/ticket/2386
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index e232c3ed2..737ae0015 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -529,6 +529,9 @@ class textui(backend.Backend):
print
raise PromptFailed(name=label)
+ def print_prompt_attribute_error(self, attribute, error):
+ self.print_plain('>>> %s: %s' % (attribute, error))
+
def prompt(self, label, default=None, get_values=None, optional=False):
"""
Prompt user for input.
@@ -1160,7 +1163,8 @@ class cli(backend.Executioner):
error = None
while True:
if error is not None:
- print '>>> %s: %s' % (unicode(param.label), unicode(error))
+ self.Backend.textui.print_prompt_attribute_error(unicode(param.label),
+ unicode(error))
raw = self.Backend.textui.prompt(param.label, default, optional=param.alwaysask or not param.required)
try:
value = param(raw, **kw)