summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-01-28 16:12:49 -0700
committerRob Crittenden <rcritten@redhat.com>2009-02-03 15:29:04 -0500
commita0aebd46a11d7cf9563489520ae4a540e2a63827 (patch)
tree07d5056b9281ea770e89329eb1612155538db978 /ipalib/cli.py
parent231f0bd65aec9cc0767bd6a76d5aa5b27dd37168 (diff)
downloadfreeipa-a0aebd46a11d7cf9563489520ae4a540e2a63827.tar.gz
freeipa-a0aebd46a11d7cf9563489520ae4a540e2a63827.tar.xz
freeipa-a0aebd46a11d7cf9563489520ae4a540e2a63827.zip
Got new ldap connection working using Connectible.connect()
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 5d5bdc34f..d0119614b 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -406,7 +406,7 @@ class help(frontend.Command):
super(help, self).finalize()
def run(self, key):
- textui = self.Backend.textui
+
if key is None:
self.print_commands()
return
@@ -529,13 +529,16 @@ class cli(backend.Executioner):
if len(argv) == 0:
self.Command.help()
return
+ self.create_context()
(key, argv) = (argv[0], argv[1:])
- cmd = self.get_command(key)
+ name = from_cli(key)
+ if name not in self.Command:
+ raise CommandError(name=key)
+ cmd = self.Command[name]
kw = self.parse(cmd, argv)
if self.env.interactive:
self.prompt_interactively(cmd, kw)
- self.create_context()
- result = cmd(**kw)
+ result = self.execute(name, **kw)
if callable(cmd.output_for_cli):
for param in cmd.params():
if param.password and param.name in kw:
@@ -543,12 +546,6 @@ class cli(backend.Executioner):
(args, options) = cmd.params_2_args_options(**kw)
cmd.output_for_cli(self.api.Backend.textui, result, *args, **options)
- def get_command(self, key):
- name = from_cli(key)
- if name not in self.Command:
- raise CommandError(name=key)
- return self.Command[name]
-
def parse(self, cmd, argv):
parser = self.build_parser(cmd)
(collector, args) = parser.parse_args(argv, Collector())