Comment 6 for bug 814981

Revision history for this message
Jay Pipes (jaypipes) wrote :

Some thoughts on solutions to this bug:

<clayg> jaypipes: I ran into that error as well, work around was of course adding the new context middleware
* dolphm has quit (Remote host closed the connection)
<jaypipes> clayg: yup... actually, dprince had suggested separating config files from paste.deploy to make things like this easier to upgrade properly... not sure I completely agree with that, though.
<clayg> but I wonder why not just if not hasattr(req, 'context'): req.context = DefaultAdminContext
<jaypipes> clayg: I added a blueprint to the openstack-ci project for this general problem... https://blueprints.launchpad.net/openstack-ci/+spec/glance-upgrade
<clayg> i don't know splitting your paste config from the app config, paste deploy .ini configs are pretty standard these days
<clayg> i don't really see it as an upgrade problem as much as a "required middleware" problem
<clayg> why should the app assume that something upstream added a non-standard attribute to the request?
<jaypipes> clayg: I gather you are suggesting the best way would to have not created required middleware :)
<clayg> I just mean the app could make a default decision if context attribute isn't there
<jaypipes> clayg: ya, I hear you.
<clayg> ok
<jaypipes> clayg: or even add it to wsgi.environ['context'] instead, making it environ.get('context')'able...
<jaypipes> clayg: which I think may have been how nova implemented it... anyways, point taken :)
<clayg> idk, namespacing problems apply either way, when you add an attribute to a request webob's just putting it in environ['addhoc-attrs']['attr_name']
<creiht> wsgi.environ['glance.context']
<creiht> :)
<creiht> is typical for that type of stuff
<jaypipes> creiht: ah, yes, thx
<clayg> I presonally always liked adding a attribute with the name of the app - which itself is a dict i.e. req.glance.get('context', default_context)