[Freeipa-devel] [PATCH] 0119 Switch client to JSON-RPC

Rob Crittenden rcritten at redhat.com
Mon Apr 1 21:37:47 UTC 2013


Petr Viktorin wrote:
> On 01/15/2013 12:36 PM, Petr Viktorin wrote:
>> I meant to hold this patch a while longer to let it mature, but from
>> what Brian Smith asked on the user list it seems it could help him.
>>
>> Design: http://freeipa.org/page/V3/JSON-RPC
>> Ticket: https://fedorahosted.org/freeipa/ticket/3299
>>
>> See the design page for what the patch does.
>>
>>
>> As much as I've tried to avoid them, the code includes some workarounds:
>> It extends xmlrpclib to also support JSON. This is rather intrusive, but
>> to not do that I'd need to write a parallel stack for JSON, without the
>> help of a standard library.
>> The registration of either jsonclient or xmlclient as "rpcclient" in the
>> API also needs a bit of magic, since the framework requires the class
>> name to match the attribute.
>>
>>
>> To prevent backwards compatibility problems, we need to ensure that all
>> official JSON clients send the API version, so this patch should be
>> applied after my patches 0104-0106.
>>
>
> Updating to current master.

Please reverse this change in ipalib/rpc.py:

@@ -665,8 +788,6 @@ class xmlclient(Connectible):
              except Exception, e:
                  if not fallback:
                      raise
-                else:
-                    self.log.info('Connection to %s failed with %s', 
url, e)
                  serverproxy = None

This logs connection errors when the client fails over to another server.

The changes look really good. The show stopper is that using jsonrpc 
doesn't create a session key. I noticed that xmlrpc_uri is hardcoded 
into ipalib/session.py but it appears the issue is deeper than that.

I did some basic testing with an old client against this server and 
things seem to be fine.

I get the same results running the unit tests with both rpclib settings.

rob




More information about the Freeipa-devel mailing list