On 03/12/2015 07:24 PM, Erinn Looney-Triggs wrote:
On 03/12/2015 02:10 AM, Jan Cholasta wrote:
Dne 12.3.2015 v 08:25 Martin Kosek napsal(a):
On 03/11/2015 09:05 PM, Dmitri Pal wrote:
On 03/11/2015 03:15 PM, Erinn Looney-Triggs wrote:
...
Third, there appears to be a behavior change from in ipalib.
I cleaned up a little inventory script for ansible, you can
take a look at it here:
https://github.com/ansible/ansible/blob/devel/plugins/inventory/freeipa.py




Before RHEL 7.1 the call to api.Command.hostgroup_find()['result']
on line 30 worked, now it fails:

Traceback (most recent call last): File "./freeipa.py", line
133, in <module> list_groups(api) File "./freeipa.py", line
71, in list_groups result =
api.Command.host_find()['result'] File
"/usr/lib/python2.7/site-packages/ipalib/frontend.py", line
439, in __call__ ret = self.run(*args, **options) File
"/usr/lib/python2.7/site-packages/ipalib/frontend.py", line
755, in run return self.forward(*args, **options) File
"/usr/lib/python2.7/site-packages/ipalib/frontend.py", line
776, in forward return
self.Backend.rpcclient.forward(self.name, *args, **kw) File
"/usr/lib/python2.7/site-packages/ipalib/rpc.py", line 880,
in forward command = getattr(self.conn, name) File
"/usr/lib/python2.7/site-packages/ipalib/backend.py", line
97, in __get_conn self.id,
threading.currentThread().getName()) AttributeError: no
context.rpcclient in thread 'MainThread'

Is this expected? Is this a regression?

Some things changed. I would leave for developers to take a
look and provide more guidance.

Erinn, it may help us if you share the whole sequence how you
bootstrap and authenticatoin the API. Honza, was there any
related change causing ^^^?


https://fedorahosted.org/freeipa/ticket/3299

There is api.Backend.xmlclient.connect() in the code, but JSON-RPC
is now used by default. This can be fixed by calling
api.Backend.rpcclient.connect() instead.


Thanks, is this backwards compatible? Or will I need to run a check
for the IPA version?

Unfortunately, I do not think this is backwards compatible. I would suggest compatibility code like:

try:
    client = api.Backend.rpcclient
except AttributeError:
    # Compatibility with FreeIPA < 4.0
    client = api.Backend.xmlclient

client.connect()

Sorry for inconvenience.

Martin

--
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go to http://freeipa.org for more info on the project

Reply via email to