Hello, This fixes a regression introduced by one of my help patches (abe26d5).
https://fedorahosted.org/freeipa/ticket/3453 -- Petr³
From 04d76fdeb4ae29665586aebbd7724b3b7d2fcbd7 Mon Sep 17 00:00:00 2001 From: Petr Viktorin <[email protected]> Date: Fri, 22 Feb 2013 07:25:03 -0500 Subject: [PATCH] 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 --- ipalib/cli.py | 6 +++--- tests/test_cmdline/test_cli.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ipalib/cli.py b/ipalib/cli.py index f1d2f874319800d8e4e1576019e108e80836a4e9..d267170c5984eafc77de83c4e93962c72f5c513f 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(): diff --git a/tests/test_cmdline/test_cli.py b/tests/test_cmdline/test_cli.py index 4d730d582bf4622347e882158d72fef7b7bd6c06..58d73775c325dad2824697041a6f6605fde93d89 100644 --- a/tests/test_cmdline/test_cli.py +++ b/tests/test_cmdline/test_cli.py @@ -18,7 +18,8 @@ class TestCLIParsing(object): executioner = api.Backend.cli cmd = executioner.get_command(argv) - kw_got = executioner.argv_to_keyword_arguments(cmd, argv[1:]) + kw_got = executioner.parse(cmd, argv[1:]) + kw_got = executioner.process_keyword_arguments(cmd, kw_got) util.assert_deepequal(expected_command_name, cmd.name, 'Command name') util.assert_deepequal(kw_expected, kw_got) -- 1.7.7.6
_______________________________________________ Freeipa-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/freeipa-devel
