[Freeipa-users] call implemented methods via xml-rpc

Jason Gerard DeRose jderose at redhat.com
Mon Apr 19 15:09:30 UTC 2010


On Mon, 2010-04-19 at 16:22 +0200, ALAHYANE Rachid wrote:
> Hi,
> 
> 
> Using F12 with the alpha version of ipa, I want to know if there is
> some ways to call implemented methods like  user_show() with my own
> script python. My goal is to call these methods with a client xml-rpc
> that I will to developpe later.
> 
> 
> On my client, I tried this but it does not work :(

It needs more documentation, but see doc/examples/python-api.py

Let me know if that doesn't work or if you get stuck.  You will need to
do a kinit first.

> ----------------------------------------------------------------------------
> >>> from ipalib import api
> >>> api.bootstrap_with_global_options()
> (<Values at 0xb74f556c: {'debug': None, 'conf': None, 'env': None,
> 'verbose': None}>, [])
> >>> api.load_plugins()
> >>> api.finalize()
> >>> api.Method.user_show.__doc__
> '\n    Display user.\n    '
> >>> api.Method.user_show(u'raca')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line
> 398, in __call__
>     ret = self.run(*args, **options)
>   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line
> 667, in run
>     return self.forward(*args, **options)
>   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line
> 688, in forward
>     return self.Backend.xmlclient.forward(self.name, *args, **kw)
>   File "/usr/lib/python2.6/site-packages/ipalib/rpc.py", line 403, in
> forward
>     command = getattr(self.conn, name)
>   File "/usr/lib/python2.6/site-packages/ipalib/backend.py", line 96,
> in __get_conn
>     self.id, threading.currentThread().getName())
> AttributeError: no context.xmlclient in thread 'MainThread'
> 
> 
> ----------------------------------------------------------------------------
> 
> 
> Have you any idea ? or some pertinent docs
> 
> 
> Sorry for my bad English :)
> 
> 
> -- 
> Meilleures salutations / Best Regards
> 
> Rachid ALAHYANE
> 
> 
> _______________________________________________
> Freeipa-users mailing list
> Freeipa-users at redhat.com
> https://www.redhat.com/mailman/listinfo/freeipa-users




More information about the Freeipa-users mailing list