summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-27 23:56:22 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-27 23:56:22 -0600
commit2307d4ddd0409f00511c4d83ad7dab5e9d6d96df (patch)
treeb0ded39f1c09236b5ec38993196aadf43f3b8fe4
parent83d6c95e4636049a5bcedb533ad49f6e2cf79dfe (diff)
downloadfreeipa-2307d4ddd0409f00511c4d83ad7dab5e9d6d96df.tar.gz
freeipa-2307d4ddd0409f00511c4d83ad7dab5e9d6d96df.tar.xz
freeipa-2307d4ddd0409f00511c4d83ad7dab5e9d6d96df.zip
Fixed use of depreciated env.get() in b_xmlrpc.py module
-rw-r--r--ipalib/plugins/b_xmlrpc.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/ipalib/plugins/b_xmlrpc.py b/ipalib/plugins/b_xmlrpc.py
index 572a75116..2c98fb8a6 100644
--- a/ipalib/plugins/b_xmlrpc.py
+++ b/ipalib/plugins/b_xmlrpc.py
@@ -36,23 +36,26 @@ from ipalib import errors
class xmlrpc(Backend):
"""
- Kerberos backend plugin.
+ XML-RPC client backend plugin.
"""
- def get_client(self, verbose=False):
- # FIXME: The server uri should come from self.api.env.server_uri
- if api.env.get('kerberos'):
- server = api.env.server.next()
- if verbose: print "Connecting to %s" % server
- return xmlrpclib.ServerProxy('https://%s/ipa/xml' % server, transport=KerbTransport(), verbose=verbose)
- else:
- return xmlrpclib.ServerProxy('http://localhost:8888', verbose=verbose)
+ def get_client(self):
+ """
+ Return an xmlrpclib.ServerProxy instance (the client).
+ """
+ uri = self.api.env.xmlrpc_uri
+ if uri.startswith('https://'):
+ return xmlrpclib.ServerProxy(uri,
+ transport=KerbTransport(),
+ verbose=self.api.env.verbose,
+ )
+ return xmlrpclib.ServerProxy(uri, verbose=self.api.env.verbose)
def forward_call(self, name, *args, **kw):
"""
Forward a call over XML-RPC to an IPA server.
"""
- client = self.get_client(verbose=api.env.get('verbose', False))
+ client = self.get_client()
command = getattr(client, name)
params = xmlrpc_marshal(*args, **kw)
try: