summaryrefslogtreecommitdiffstats
path: root/ipalib
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
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')
-rw-r--r--ipalib/backend.py4
-rw-r--r--ipalib/cli.py17
-rw-r--r--ipalib/frontend.py4
-rw-r--r--ipalib/rpc.py10
4 files changed, 16 insertions, 19 deletions
diff --git a/ipalib/backend.py b/ipalib/backend.py
index d484c22eb..22aa128b3 100644
--- a/ipalib/backend.py
+++ b/ipalib/backend.py
@@ -98,9 +98,9 @@ class Executioner(Backend):
def create_context(self, ccache=None, client_ip=None):
if self.env.in_server:
- self.Backend.ldap.connect(ccache=ccache)
+ self.Backend.ldap.connect(ccache)
else:
- self.Backend.xmlclient.connect(ccache=ccache)
+ self.Backend.xmlclient.connect()
def execute(self, name, *args, **options):
error = None
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())
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index eb7f45d63..fc436a7a9 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -95,14 +95,14 @@ class Command(plugable.Plugin):
XML-RPC and the executed an the nearest IPA server.
"""
params = self.args_options_2_params(*args, **options)
- self.info(
+ self.debug(
'raw: %s(%s)', self.name, ', '.join(self._repr_iter(**params))
)
params = self.normalize(**params)
params = self.convert(**params)
params.update(self.get_default(**params))
self.info(
- 'processed: %s(%s)', self.name, ', '.join(self._repr_iter(**params))
+ '%s(%s)', self.name, ', '.join(self._repr_iter(**params))
)
self.validate(**params)
(args, options) = self.params_2_args_options(**params)
diff --git a/ipalib/rpc.py b/ipalib/rpc.py
index a70b372bd..3d837b5f1 100644
--- a/ipalib/rpc.py
+++ b/ipalib/rpc.py
@@ -217,11 +217,10 @@ class xmlclient(Connectible):
self.__errors = dict((e.errno, e) for e in public_errors)
def create_connection(self, ccache=None):
- return ServerProxy(self.env.xmlrpc_uri,
- #transport=KerbTransport(),
- allow_none=True,
- encoding='UTF-8',
- )
+ kw = dict(allow_none=True, encoding='UTF-8')
+ if self.env.xmlrpc_uri.startswith('https://'):
+ kw['transport'] = KerbTransport()
+ return ServerProxy(self.env.xmlrpc_uri, **kw)
def destroy_connection(self):
pass
@@ -241,6 +240,7 @@ class xmlclient(Connectible):
raise ValueError(
'%s.forward(): %r not in api.Command' % (self.name, name)
)
+ self.info('Forwarding %r to %r', name, self.env.xmlrpc_uri)
command = getattr(self.conn, name)
params = args + (kw,)
try: