Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1730132

Summary: Keystone.common.wsgi returns traceback with LDAP | initialize() got an unexpected keyword argument 'bytes_mode'
Product: Red Hat OpenStack Reporter: Brendan Shephard <bshephar>
Component: openstack-keystoneAssignee: John Dennis <jdennis>
Status: CLOSED DUPLICATE QA Contact: nlevinki <nlevinki>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 14.0 (Rocky)CC: nkinder
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-15 22:41:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brendan Shephard 2019-07-15 22:39:19 UTC
Description of problem:
When using Keystone with a LDAP backend, we are seeing a traceback when it tries to call ldap.initialize(url, bytes_mode=False)

Full traceback is below, but the error is:
initialize() got an unexpected keyword argument 'bytes_mode': TypeError: initialize() got an unexpected keyword argument 'bytes_mode'

We can see that ldap.initialize() is being called with bytes_mode=false, which seems to not be included in the version of python-ldap that we're shipping with this container.

https://github.com/openstack/keystone/blob/c8904b8679d2aca12b69828e36cc8f6881e83373/keystone/identity/backends/ldap/common.py#L523

Version-Release number of selected component (if applicable):
openstack-keystone:14.0-107

How reproducible:
100%

Steps to Reproduce:
1. Deploy Overcloud with the keystone:14.0-107 container
2. Configure LDAP backend
3. Try to use an LDAP account

Actual results:
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi [req-49be13f1-bf07-425b-9523-f3f62168cfa6 - - - - -] initialize() got an unexpected keyword argument 'bytes_mode': TypeError: initialize() got an unexpected keyword argument 'bytes_mode'
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi Traceback (most recent call last):
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/common/wsgi.py", line 148, in __call__
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     result = method(req, **params)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/auth/controllers.py", line 67, in authenticate_for_token
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     self.authenticate(request, auth_info, auth_context)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/auth/controllers.py", line 236, in authenticate
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     auth_info.get_method_data(method_name))
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/auth/plugins/password.py", line 31, in authenticate
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     user_info = auth_plugins.UserAuthInfo.create(auth_payload, METHOD_NAME)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/auth/plugins/core.py", line 102, in create
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     user_auth_info._validate_and_normalize_auth_data(auth_payload)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/auth/plugins/core.py", line 189, in _validate_and_normalize_auth_data
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     auth_payload)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/auth/plugins/core.py", line 166, in _validate_and_normalize_auth_data
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     user_name, domain_ref['id'])
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/common/manager.py", line 116, in wrapped
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     __ret_val = __f(*args, **kwargs)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/core.py", line 416, in wrapper
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     return f(self, *args, **kwargs)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/core.py", line 426, in wrapper
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     return f(self, *args, **kwargs)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/dogpile/cache/region.py", line 1220, in decorate
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     should_cache_fn)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/dogpile/cache/region.py", line 825, in get_or_create
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     async_creator) as value:
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/dogpile/lock.py", line 154, in __enter__
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     return self._enter()
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/dogpile/lock.py", line 94, in _enter
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     generated = self._enter_create(createdtime)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/dogpile/lock.py", line 145, in _enter_create
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     created = self.creator()
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/dogpile/cache/region.py", line 792, in gen_value
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     created_value = creator()
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/dogpile/cache/region.py", line 1216, in creator
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     return fn(*arg, **kw)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/core.py", line 983, in get_user_by_name
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     ref = driver.get_user_by_name(user_name, domain_id)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/backends/ldap/core.py", line 97, in get_user_by_name
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     return self.user.filter_attributes(self.user.get_by_name(user_name))
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/backends/ldap/common.py", line 1555, in get_by_name
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     res = self.get_all(query)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/backends/ldap/core.py", line 319, in get_all
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     hints=hints)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/backends/ldap/common.py", line 1862, in get_all
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     return super(EnabledEmuMixIn, self).get_all(ldap_filter, hints)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/backends/ldap/common.py", line 1564, in get_all
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     for x in self._ldap_get_all(hints, ldap_filter)]
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/common/driver_hints.py", line 42, in wrapper
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     return f(self, hints, *args, **kwargs)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/backends/ldap/common.py", line 1512, in _ldap_get_all
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     with self.get_connection() as conn:
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/backends/ldap/common.py", line 1250, in get_connection
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     pool_conn_lifetime=pool_conn_lifetime)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/backends/ldap/common.py", line 907, in connect
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     pool_conn_lifetime=pool_conn_lifetime)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi   File "/usr/lib/python2.7/site-packages/keystone/identity/backends/ldap/common.py", line 523, in connect
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi     self.conn = ldap.initialize(url, bytes_mode=False)
2019-07-11 20:37:03.107 1269 ERROR keystone.common.wsgi TypeError: initialize() got an unexpected keyword argument 'bytes_mode'

Expected results:
No traceback

Additional info:
If you just remove bytes_mode=false from the ldap.initialize(url, bytes_mode=False), it works fine.

Comment 1 John Dennis 2019-07-15 22:41:54 UTC

*** This bug has been marked as a duplicate of bug 1727976 ***