From 1e836d2d0c8916f5b8a352cc8395048f1147554d Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 19 Dec 2012 04:25:24 -0500 Subject: Switch client to JSON-RPC Modify ipalib.rpc to support JSON-RPC in addition to XML-RPC. This is done by subclassing and extending xmlrpclib, because our existing code relies on xmlrpclib internals. The URI to use is given in the new jsonrpc_uri env variable. When it is not given, it is generated from xmlrpc_uri by replacing /xml with /json. The rpc_json_uri env variable existed before, but was unused, undocumented and not set the install scripts. This patch removes it in favor of jsonrpc_uri (for consistency with xmlrpc_uri). Add the rpc_protocol env variable to control the protocol IPA uses. rpc_protocol defaults to 'jsonrpc', but may be changed to 'xmlrpc'. Make backend.Executioner and tests use the backend specified by rpc_protocol. For compatibility with unwrap_xml, decoding JSON now gives tuples instead of lists. Design: http://freeipa.org/page/V3/JSON-RPC Ticket: https://fedorahosted.org/freeipa/ticket/3299 --- ipa-client/ipa-install/ipa-client-automount | 2 +- ipa-client/ipa-install/ipa-client-install | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'ipa-client/ipa-install') diff --git a/ipa-client/ipa-install/ipa-client-automount b/ipa-client/ipa-install/ipa-client-automount index 2ce31dcb9..076bf0819 100755 --- a/ipa-client/ipa-install/ipa-client-automount +++ b/ipa-client/ipa-install/ipa-client-automount @@ -436,7 +436,7 @@ def main(): sys.exit("Failed to obtain host TGT.") # Now we have a TGT, connect to IPA try: - api.Backend.xmlclient.connect() + api.Backend.rpcclient.connect() except errors.KerberosError, e: sys.exit('Cannot connect to the server due to ' + str(e)) try: diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install index e79cb48b0..c74e6840c 100755 --- a/ipa-client/ipa-install/ipa-client-install +++ b/ipa-client/ipa-install/ipa-client-install @@ -1492,7 +1492,7 @@ def update_ssh_keys(server, hostname, ssh_dir, create_sshfp): try: # Use the RPC directly so older servers are supported - api.Backend.xmlclient.forward( + api.Backend.rpcclient.forward( 'host_mod', unicode(hostname), ipasshpubkey=[pk.openssh() for pk in pubkeys], @@ -2458,19 +2458,19 @@ def install(options, env, fstore, statestore): # Now, let's try to connect to the server's XML-RPC interface connected = False try: - api.Backend.xmlclient.connect() + api.Backend.rpcclient.connect() connected = True root_logger.debug('Try RPC connection') - api.Backend.xmlclient.forward('ping') + api.Backend.rpcclient.forward('ping') except errors.KerberosError, e: if connected: - api.Backend.xmlclient.disconnect() + api.Backend.rpcclient.disconnect() root_logger.info('Cannot connect to the server due to ' + 'Kerberos error: %s. Trying with delegate=True', str(e)) try: - api.Backend.xmlclient.connect(delegate=True) + api.Backend.rpcclient.connect(delegate=True) root_logger.debug('Try RPC connection') - api.Backend.xmlclient.forward('ping') + api.Backend.rpcclient.forward('ping') root_logger.info('Connection with delegate=True successful') @@ -2493,7 +2493,7 @@ def install(options, env, fstore, statestore): return CLIENT_INSTALL_ERROR # Use the RPC directly so older servers are supported - result = api.Backend.xmlclient.forward( + result = api.Backend.rpcclient.forward( 'env', server=True, version=u'2.0', -- cgit