Skip to content
This repository has been archived by the owner on Mar 21, 2019. It is now read-only.

[py3] get_structural_oc: AttributeError: 'dict_keys' object has no attribute 'pop' #84

Closed
tiran opened this issue Feb 15, 2017 · 6 comments
Labels

Comments

@tiran
Copy link
Contributor

tiran commented Feb 15, 2017

get_structural_oc is broken on Python 3. It tries to use the method pop on a dict_keys instance. The issue breaks FreeIPA's Python 3 support.

CC @MartinBasti

ipa: ERROR: non-public: AttributeError: 'dict_keys' object has no attribute 'pop'
Traceback (most recent call last):
  File "/home/heimes/redhat/freeipa/ipaserver/rpcserver.py", line 368, in wsgi_execute
    result = command(*args, **options)
  File "/home/heimes/redhat/freeipa/ipalib/frontend.py", line 447, in __call__
    return self.__do_call(*args, **options)
  File "/home/heimes/redhat/freeipa/ipalib/frontend.py", line 475, in __do_call
    ret = self.run(*args, **options)
  File "/home/heimes/redhat/freeipa/ipalib/frontend.py", line 797, in run
    return self.execute(*args, **options)
  File "/home/heimes/redhat/freeipa/ipaserver/plugins/internal.py", line 85, in execute
    (o.name, json_serialize(o)) for o in self.api.Object()
  File "/home/heimes/redhat/freeipa/ipaserver/plugins/internal.py", line 86, in <genexpr>
    if o is self.api.Object[o.name]
  File "/home/heimes/redhat/freeipa/ipalib/util.py", line 72, in json_serialize
    return json_serialize(obj.__json__())
  File "/home/heimes/redhat/freeipa/ipaserver/plugins/baseldap.py", line 798, in __json__
    attrs = self.api.Backend.ldap2.schema.attribute_types(objectclasses)
  File "/usr/lib64/python3.5/site-packages/ldap/schema/subentry.py", line 398, in attribute_types
    structural_oc = self.get_structural_oc(object_class_list)
  File "/usr/lib64/python3.5/site-packages/ldap/schema/subentry.py", line 301, in get_structural_oc
    oid = struct_oc_list.pop()
AttributeError: 'dict_keys' object has no attribute 'pop'
@tiran tiran added the bug label Feb 15, 2017
@tiran
Copy link
Contributor Author

tiran commented Feb 15, 2017

$ rpm -qa python3-pyldap
python3-pyldap-2.4.25.1-2.fc25.x86_64

@hroncok
Copy link
Member

hroncok commented Feb 15, 2017

Attempting Koji scratch build of the latest release: https://koji.fedoraproject.org/koji/taskinfo?taskID=17882821

@hroncok
Copy link
Member

hroncok commented Feb 15, 2017

Try with:

dnf update https://kojipkgs.fedoraproject.org/work/tasks/2829/17882829/python3-pyldap-2.4.28-1.fc25.x86_64.rpm

@tiran
Copy link
Contributor Author

tiran commented Feb 15, 2017

Still broken with 2.4.28

  File "/home/heimes/redhat/freeipa/ipaserver/plugins/baseldap.py", line 798, in __json__
    attrs = self.api.Backend.ldap2.schema.attribute_types(objectclasses)
  File "/usr/lib64/python3.5/site-packages/ldap/schema/subentry.py", line 398, in attribute_types
    structural_oc = self.get_structural_oc(object_class_list)
  File "/usr/lib64/python3.5/site-packages/ldap/schema/subentry.py", line 301, in get_structural_oc
    oid = struct_oc_list.pop()
AttributeError: 'dict_keys' object has no attribute 'pop'
...
$ rpm -qf /usr/lib64/python3.5/site-packages/ldap/schema/subentry.py
python3-pyldap-2.4.28-1.fc25.x86_64

rbarrois added a commit to rbarrois/pyldap that referenced this issue Jun 18, 2017
Remove usage of dict.keys().pop().

Closes pyldap#84.
@rbarrois
Copy link
Contributor

@tiran PR #100 should fix it, could you test it?

I'm afraid we don't have any tests for that codepath in the pyldap codebase yet :/

@encukou
Copy link
Contributor

encukou commented Jun 19, 2017

@tiran, I merged #100 before I read the request to test it. But if you have time, post-merge testing would be welcome as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants