← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1369388] [NEW] local configuration is not allowed in "keystone-paste.ini"

 

Public bug reported:

According to funcation docs in keystone/common/wsgi.py, local configuration is allowed in the paste.deploy config files, such as "redis_host".
380     @classmethod
381     def factory(cls, global_config, **local_config):
382         """Used for paste app factories in paste.deploy config files.
383
384         Any local configuration (that is, values under the [filter:APPNAME]
385         section of the paste config) will be passed into the `__init__` method
386         as kwargs.
387
388         A hypothetical configuration would look like:
389
390             [filter:analytics]
391             redis_host = 127.0.0.1
392             paste.filter_factory = keystone.analytics:Analytics.factory
393
394         which would result in a call to the `Analytics` class as
395
396             import keystone.analytics
397             keystone.analytics.Analytics(app, redis_host='127.0.0.1')
398
399         You could of course re-implement the `factory` method in subclasses,
400         but using the kwarg passing it shouldn't be necessary.
401
402         """

And in the following implemenation, local configuration is indeed readed from paste.deploy config files.
406             return cls(app, **local_config)

But, the local_config is not allowed in the constructor where only "app" is passed into the constructor.
409     def __init__(self, application):
410         super(Middleware, self).__init__()
411         self.application = application

So, if we configure paste.deploy config files like what the method docs says, it will always fails as:
[Sun Sep 14 22:40:37.316517 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590] mod_wsgi (pid=22196): Exception occurred processing WSGI script '/var/www/keystone/admin'.
[Sun Sep 14 22:40:37.316554 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590] Traceback (most recent call last):
[Sun Sep 14 22:40:37.316564 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/var/www/keystone/admin", line 59, in <module>
[Sun Sep 14 22:40:37.316626 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     name=name)
[Sun Sep 14 22:40:37.316644 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
[Sun Sep 14 22:40:37.316795 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return loadobj(APP, uri, name=name, **kw)
[Sun Sep 14 22:40:37.316803 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
[Sun Sep 14 22:40:37.316822 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return context.create()
[Sun Sep 14 22:40:37.316827 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
[Sun Sep 14 22:40:37.316851 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return self.object_type.invoke(self)
[Sun Sep 14 22:40:37.316856 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 144, in invoke
[Sun Sep 14 22:40:37.316863 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     **context.local_conf)
[Sun Sep 14 22:40:37.316868 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 58, in fix_call
[Sun Sep 14 22:40:37.316919 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     reraise(*exc_info)
[Sun Sep 14 22:40:37.316927 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/compat.py", line 23, in reraise
[Sun Sep 14 22:40:37.316979 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
[Sun Sep 14 22:40:37.316986 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
[Sun Sep 14 22:40:37.316995 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     val = callable(*args, **kw)
[Sun Sep 14 22:40:37.316999 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 28, in urlmap_factory
[Sun Sep 14 22:40:37.317074 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     app = loader.get_app(app_name, global_conf=global_conf)
[Sun Sep 14 22:40:37.317080 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 350, in get_app
[Sun Sep 14 22:40:37.317100 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     name=name, global_conf=global_conf).create()
[Sun Sep 14 22:40:37.317104 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
[Sun Sep 14 22:40:37.317121 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return self.object_type.invoke(self)
[Sun Sep 14 22:40:37.317125 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 207, in invoke
[Sun Sep 14 22:40:37.317132 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     app = filter(app)
[Sun Sep 14 22:40:37.317136 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/opt/stack/keystone/keystone/common/wsgi.py", line 406, in _factory
[Sun Sep 14 22:40:37.317278 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return cls(app, **local_config)
[Sun Sep 14 22:40:37.317301 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590] TypeError: __init__() got an unexpected keyword argument 'redis_host'.

** Affects: keystone
     Importance: Undecided
     Assignee: Dave Chen (wei-d-chen)
         Status: New

** Changed in: openstack-manuals
     Assignee: (unassigned) => Dave Chen (wei-d-chen)

** Project changed: openstack-manuals => keystone

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

Title:
  local configuration is not allowed in "keystone-paste.ini"

Status in OpenStack Identity (Keystone):
  New

Bug description:
  According to funcation docs in keystone/common/wsgi.py, local configuration is allowed in the paste.deploy config files, such as "redis_host".
  380     @classmethod
  381     def factory(cls, global_config, **local_config):
  382         """Used for paste app factories in paste.deploy config files.
  383
  384         Any local configuration (that is, values under the [filter:APPNAME]
  385         section of the paste config) will be passed into the `__init__` method
  386         as kwargs.
  387
  388         A hypothetical configuration would look like:
  389
  390             [filter:analytics]
  391             redis_host = 127.0.0.1
  392             paste.filter_factory = keystone.analytics:Analytics.factory
  393
  394         which would result in a call to the `Analytics` class as
  395
  396             import keystone.analytics
  397             keystone.analytics.Analytics(app, redis_host='127.0.0.1')
  398
  399         You could of course re-implement the `factory` method in subclasses,
  400         but using the kwarg passing it shouldn't be necessary.
  401
  402         """

  And in the following implemenation, local configuration is indeed readed from paste.deploy config files.
  406             return cls(app, **local_config)

  But, the local_config is not allowed in the constructor where only "app" is passed into the constructor.
  409     def __init__(self, application):
  410         super(Middleware, self).__init__()
  411         self.application = application

  So, if we configure paste.deploy config files like what the method docs says, it will always fails as:
  [Sun Sep 14 22:40:37.316517 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590] mod_wsgi (pid=22196): Exception occurred processing WSGI script '/var/www/keystone/admin'.
  [Sun Sep 14 22:40:37.316554 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590] Traceback (most recent call last):
  [Sun Sep 14 22:40:37.316564 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/var/www/keystone/admin", line 59, in <module>
  [Sun Sep 14 22:40:37.316626 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     name=name)
  [Sun Sep 14 22:40:37.316644 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
  [Sun Sep 14 22:40:37.316795 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return loadobj(APP, uri, name=name, **kw)
  [Sun Sep 14 22:40:37.316803 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
  [Sun Sep 14 22:40:37.316822 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return context.create()
  [Sun Sep 14 22:40:37.316827 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
  [Sun Sep 14 22:40:37.316851 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return self.object_type.invoke(self)
  [Sun Sep 14 22:40:37.316856 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 144, in invoke
  [Sun Sep 14 22:40:37.316863 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     **context.local_conf)
  [Sun Sep 14 22:40:37.316868 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 58, in fix_call
  [Sun Sep 14 22:40:37.316919 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     reraise(*exc_info)
  [Sun Sep 14 22:40:37.316927 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/compat.py", line 23, in reraise
  [Sun Sep 14 22:40:37.316979 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
  [Sun Sep 14 22:40:37.316986 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
  [Sun Sep 14 22:40:37.316995 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     val = callable(*args, **kw)
  [Sun Sep 14 22:40:37.316999 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 28, in urlmap_factory
  [Sun Sep 14 22:40:37.317074 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     app = loader.get_app(app_name, global_conf=global_conf)
  [Sun Sep 14 22:40:37.317080 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 350, in get_app
  [Sun Sep 14 22:40:37.317100 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     name=name, global_conf=global_conf).create()
  [Sun Sep 14 22:40:37.317104 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
  [Sun Sep 14 22:40:37.317121 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return self.object_type.invoke(self)
  [Sun Sep 14 22:40:37.317125 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 207, in invoke
  [Sun Sep 14 22:40:37.317132 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     app = filter(app)
  [Sun Sep 14 22:40:37.317136 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]   File "/opt/stack/keystone/keystone/common/wsgi.py", line 406, in _factory
  [Sun Sep 14 22:40:37.317278 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590]     return cls(app, **local_config)
  [Sun Sep 14 22:40:37.317301 2014] [:error] [pid 22196:tid 139709922383616] [remote 10.239.4.160:27590] TypeError: __init__() got an unexpected keyword argument 'redis_host'.

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


Follow ups

References