← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1713574] Re: python 3 errors with memcache enabled

 

Reviewed:  https://review.openstack.org/510241
Committed: https://git.openstack.org/cgit/openstack/keystonemiddleware/commit/?id=74455d80575aa174db0217c5eae905eacab42d78
Submitter: Zuul
Branch:    master

commit 74455d80575aa174db0217c5eae905eacab42d78
Author: Tin Lam <tin@xxxxxxxxxxxxx>
Date:   Thu Oct 5 21:47:30 2017 -0500

    Fix py3 byte/string error
    
    This patch set corrects a problem when the keystonemiddleware is
    executed with memcache encryption enabled.  Currently, the
    hmac.new() calls throw exceptions in python3 due to how py2 and py3
    handles string vs. byte/bytearray.
    
    Co-Authored-By: Rohan Arora <ra271w@xxxxxxx>
    
    Closes-Bug: #1713574
    Change-Id: I9bb291be48a094b9f266a8459a3f51ee163d33a3


** Changed in: keystonemiddleware
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1713574

Title:
  python 3 errors with memcache enabled

Status in OpenStack Identity (keystone):
  Invalid
Status in keystoneauth:
  New
Status in keystonemiddleware:
  Fix Released

Bug description:
  Hi, we are using gnocchi 4 running the following:

  keystoneauth1 (3.1.0)
  keystonemiddleware (4.14.0)
  python-keystoneclient (3.13.0)

  with python 3.5.4

  on a configuration file like this :

  [keystone_authtoken]
  signing_dir = /var/cache/gnocchi
  project_domain_name = default
  user_domain_name = default
  signing_dir = /var/cache/gnocchi
  auth_uri = http://yourmomkeystone.com:5000/v3
  auth_url = http://yourmomkeystone.com:35357/v3
  project_name = admin
  password = porotito
  username = cloudadmin
  auth_type = password
  auth_type = password
  memcached_servers = yourmommecached:11211
  insecure=true
  endpoint_type = internal
  region_name = yourmomregion
  memcache_security_strategy = ENCRYPT
  memcache_secret_key = lalalalalalaalala

  After the api starts, the token is asked successfully, but we have
  this stacktrace when trying to use memcached.

  2017-08-28 20:12:41,029 [7] CRITICAL root: Traceback (most recent call last):
    File "/usr/local/lib/python3.5/site-packages/webob/dec.py", line 131, in __call__
      resp = self.call_func(req, *args, **self.kwargs)
    File "/usr/local/lib/python3.5/site-packages/webob/dec.py", line 196, in call_func
      return self.func(req, *args, **kwargs)
    File "/usr/local/lib/python3.5/site-packages/oslo_middleware/base.py", line 131, in __call__
      response = req.get_response(self.application)
    File "/usr/local/lib/python3.5/site-packages/webob/request.py", line 1316, in send
      application, catch_exc_info=False)
    File "/usr/local/lib/python3.5/site-packages/webob/request.py", line 1280, in call_application
      app_iter = application(self.environ, start_response)
    File "/usr/local/lib/python3.5/site-packages/paste/urlmap.py", line 216, in __call__
      return app(environ, start_response)
    File "/usr/local/lib/python3.5/site-packages/webob/dec.py", line 131, in __call__
      resp = self.call_func(req, *args, **self.kwargs)
    File "/usr/local/lib/python3.5/site-packages/webob/dec.py", line 196, in call_func
      return self.func(req, *args, **kwargs)
    File "/usr/local/lib/python3.5/site-packages/oslo_middleware/base.py", line 131, in __call__
      response = req.get_response(self.application)
    File "/usr/local/lib/python3.5/site-packages/webob/request.py", line 1316, in send
      application, catch_exc_info=False)
    File "/usr/local/lib/python3.5/site-packages/webob/request.py", line 1280, in call_application
      app_iter = application(self.environ, start_response)
    File "/usr/local/lib/python3.5/site-packages/webob/dec.py", line 131, in __call__
      resp = self.call_func(req, *args, **self.kwargs)
    File "/usr/local/lib/python3.5/site-packages/webob/dec.py", line 196, in call_func
      return self.func(req, *args, **kwargs)
    File "/usr/local/lib/python3.5/site-packages/keystonemiddleware/auth_token/__init__.py", line 331, in __call__
      response = self.process_request(req)
    File "/usr/local/lib/python3.5/site-packages/keystonemiddleware/auth_token/__init__.py", line 622, in process_request
      resp = super(AuthProtocol, self).process_request(request)
    File "/usr/local/lib/python3.5/site-packages/keystonemiddleware/auth_token/__init__.py", line 404, in process_request
      allow_expired=allow_expired)
    File "/usr/local/lib/python3.5/site-packages/keystonemiddleware/auth_token/__init__.py", line 434, in _do_fetch_token
      data = self.fetch_token(token, **kwargs)
    File "/usr/local/lib/python3.5/site-packages/keystonemiddleware/auth_token/__init__.py", line 736, in fetch_token
      cached = self._cache_get_hashes(token_hashes)
    File "/usr/local/lib/python3.5/site-packages/keystonemiddleware/auth_token/__init__.py", line 719, in _cache_get_hashes
      cached = self._token_cache.get(token)
    File "/usr/local/lib/python3.5/site-packages/keystonemiddleware/auth_token/_cache.py", line 212, in get
      key, context = self._get_cache_key(token_id)
    File "/usr/local/lib/python3.5/site-packages/keystonemiddleware/auth_token/_cache.py", line 268, in _get_cache_key
      self._security_strategy)
    File "/usr/local/lib/python3.5/site-packages/keystonemiddleware/auth_token/_memcache_crypt.py", line 101, in derive_keys
      digest = hmac.new(secret, token + strategy, HASH_FUNCTION).digest()
  TypeError: Can't convert 'bytes' object to str implicitly

  any help ?

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1713574/+subscriptions


References