← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1241000] Re: some modules with translation cannot be imported outside of keystone

 

*** This bug is a duplicate of bug 1255518 ***
    https://bugs.launchpad.net/bugs/1255518

Duplicate of 1255518

** This bug has been marked a duplicate of bug 1255518
   name '_' is not defined, under nosetests.

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1241000

Title:
  some modules with translation cannot be imported outside of keystone

Status in OpenStack Identity (Keystone):
  Triaged

Bug description:
  Keystone uses gettext.install() to set _ as the builtin translation
  function in modules at runtime, see
  https://github.com/openstack/keystone/search?q=gettextutils+install&ref=cmdform

  But when importing some modules containing translated strings into
  another context (typically a middleware like swift3), the import
  fails, example:

  mhu@devstack:/opt/stack/tempest$ cd /opt/stack/swift && /opt/stack/swift/bin/swift-proxy-server /etc/swift/proxy-server.conf -v || echo "s-proxy failed to start" | tee "/opt/stack/status/stack/s-proxy.failure"
  Traceback (most recent call last):
    File "/opt/stack/swift/bin/swift-proxy-server", line 22, in <module>
      run_wsgi(conf_file, 'proxy-server', default_port=8080, **options)
    File "/opt/stack/swift/swift/common/wsgi.py", line 256, in run_wsgi
      loadapp(conf_path, global_conf={'log_name': log_name})
    File "/opt/stack/swift/swift/common/wsgi.py", line 107, in wrapper
      return f(conf_uri, *args, **kwargs)
    File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
      return loadobj(APP, uri, name=name, **kw)
    File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 271, in loadobj
      global_conf=global_conf)
    File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
      global_conf=global_conf)
    File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 320, in _loadconfig
      return loader.get_context(object_type, name, global_conf)
    File "/opt/stack/swift/swift/common/wsgi.py", line 55, in get_context
      object_type, name=name, global_conf=global_conf)
    File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 450, in get_context
      global_additions=global_additions)
    File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 562, in _pipeline_app_context
      for name in pipeline[:-1]]
    File "/opt/stack/swift/swift/common/wsgi.py", line 55, in get_context
      object_type, name=name, global_conf=global_conf)
    File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 458, in get_context
      section)
    File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 517, in _context_from_explicit
      value = import_string(found_expr)
    File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 22, in import_string
      return pkg_resources.EntryPoint.parse("x=" + s).load(False)
    File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2013, in load
      entry = __import__(self.module_name, globals(),globals(), ['__name__'])
    File "/opt/stack/keystone/keystone/middleware/__init__.py", line 18, in <module>
      from keystone.middleware.core import *
    File "/opt/stack/keystone/keystone/middleware/core.py", line 21, in <module>
      from keystone.common import utils
    File "/opt/stack/keystone/keystone/common/utils.py", line 32, in <module>
      from keystone import exception
    File "/opt/stack/keystone/keystone/exception.py", line 63, in <module>
      class ValidationError(Error):
    File "/opt/stack/keystone/keystone/exception.py", line 64, in ValidationError
      message_format = _("Expecting to find %(attribute)s in %(target)s."
  NameError: name '_' is not defined
  s-proxy failed to start

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