** Expected results: run without the above error
I'm trying to reproduce this with the following script, which is the same that the failed job was trying to do: #!/usr/bin/env python import ovirtsdk.api import ovirtsdk.xml api = ovirtsdk.api.API( url="https://ovirt.example.com/ovirt-engine/api", username="admin@internal", password="******", ca_file="/etc/pki/ovirt-engine/ca.pem", debug=True, ) user = api.users.get(name="myuser") role = api.roles.get(name="UserRole") vm = api.vms.get(name="myvm") permission = ovirtsdk.xml.params.Permission( role=role, vm=vm ) user.permissions.add(permission) api.disconnect() This should trigger the problem, because it is trying to generate XML for a Python object that contains references to brokers classes, in particular a reference to a brokers.VM class. But in fact the __setattr__ method of the base class of all parameter methods replaces (or tries to replace) brokers with the corresponding parameter classes, so the instance of brokers.VM will be replaced with the corresponding params.VM class. The result is that I can't reproduce the problem. I'm still reasonably convinced that the problem is the clashing "export" methods, and that should be fixed, but I can't find a way to trigger the issue. Can you prepare a simple script where the issue reproduces?
maybe we can see the reason why its not reproduced cause in my commit https://gerrit.eng.lab.tlv.redhat.com/#/c/13984/22/art/core_api/ovirtsdk_utils.py I use : entity.__dict__[property_name] = property_value which skip the __setattr__ it make sense to you??
Yes, it makes all the sense. I can now reproduce the issue with this script: ---8<--- #!/usr/bin/env python import ovirtsdk.api import ovirtsdk.xml api = ovirtsdk.api.API( url="https://ovirt.example.com/ovirt-engine/api", username="admin@internal", password="******", ca_file="/etc/pki/ovirt-engine/ca.pem", debug=False, ) # Find the user: user = api.users.get(name="admin") # Find the role: role = api.roles.get(name="UserRole") # Find the VM: vm = api.vms.get(name="myvm") # Create the permission, and use the previously retrieved # role and virtual machine to populate it accessing directly # the attribute dictionary (this is bad practice): permission = ovirtsdk.xml.params.Permission() permission.__dict__["role"] = role permission.__dict__["vm"] = vm # Add the permission: user.permissions.add(permission) api.disconnect() --->8--- Then the result is the following exception, same that in the description of the bug: ---8<--- Traceback (most recent call last): File "./modify-permission.py", line 33, in <module> user.permissions.add(permission) File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py", line 21140, in add body=ParseHelper.toXml(permission), File "/usr/lib/python2.7/site-packages/ovirtsdk/utils/parsehelper.py", line 53, in toXml entity.export(output, 0, name_=entity_tag) File "/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py", line 13305, in export self.exportChildren(outfile, level + 1, namespace_, name_, pretty_print=pretty_print) File "/usr/lib/python2.7/site-packages/ovirtsdk/xml/params.py", line 13333, in exportChildren self.vm.export(outfile, level, namespace_, name_='vm', pretty_print=pretty_print) TypeError: export() takes at most 3 arguments (6 given) --->8--- After the proposed fix it works correctly. Note however that using __dict__ in this way is bad practice, and it may produce other unexpected results. Refrain from using it.
Verified on: ovirt-engine-3.6.0-0.0.master.20150627185750.git6f063c1.el6.noarch with engine: https://10.35.161.178/ovirt-engine run Juan script(above) without any errors
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHEA-2016-0403.html