summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-02-22 07:25:03 -0500
committerMartin Kosek <mkosek@redhat.com>2013-02-26 18:19:27 +0100
commit6b1111d1619dd82967421768fb84870e7e9cc5d6 (patch)
tree8b4eb3c3545a9f29416a0be49fffd09e48aaeb44 /ipalib
parent6540a25979b1c5dc87c2bacee9b96a5be8150a5e (diff)
downloadfreeipa.git-6b1111d1619dd82967421768fb84870e7e9cc5d6.tar.gz
freeipa.git-6b1111d1619dd82967421768fb84870e7e9cc5d6.tar.xz
freeipa.git-6b1111d1619dd82967421768fb84870e7e9cc5d6.zip
cli: Do interactive prompting after a context is created
Some commands require a connection for interactive prompting. Prompt after the connection is created. Option parsing is still done before connecting so that help can be printed out without a Kerberos ticket. https://fedorahosted.org/freeipa/ticket/3453
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index f1d2f874..d267170c 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -1039,9 +1039,8 @@ class cli(backend.Executioner):
cmd = self.Command[name]
return cmd
- def argv_to_keyword_arguments(self, cmd, argv):
+ def process_keyword_arguments(self, cmd, kw):
"""Get the keyword arguments for a Command"""
- kw = self.parse(cmd, argv)
if self.env.interactive:
self.prompt_interactively(cmd, kw)
kw = cmd.split_csv(**kw)
@@ -1062,10 +1061,11 @@ class cli(backend.Executioner):
if cmd is None:
return
name = cmd.name
- kw = self.argv_to_keyword_arguments(cmd, argv[1:])
+ kw = self.parse(cmd, argv[1:])
if not isinstance(cmd, frontend.Local):
self.create_context()
try:
+ kw = self.process_keyword_arguments(cmd, kw)
result = self.execute(name, **kw)
if callable(cmd.output_for_cli):
for param in cmd.params():