pecan: Make admin context if no context was created
Simlarly to legacy [1] this patch creates context in case environment doesn't have one. Closes-bug: #1673105 [1] https://git.openstack.org/cgit/openstack/neutron/tree/neutron/wsgi.py?id=fe4559f475757c7fc1314862eba4705a27c06c87#n276 Change-Id: I4bf17d115166a8b18b054da41e79914eab27f6d3
This commit is contained in:
parent
fe4559f475
commit
86866f9ba5
|
@ -13,6 +13,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import context
|
||||
from pecan import hooks
|
||||
|
||||
|
||||
|
@ -21,5 +22,6 @@ class ContextHook(hooks.PecanHook):
|
|||
priority = 95
|
||||
|
||||
def before(self, state):
|
||||
ctx = state.request.environ['neutron.context']
|
||||
ctx = (state.request.environ.get('neutron.context') or
|
||||
context.get_admin_context())
|
||||
state.request.context['neutron_context'] = ctx
|
||||
|
|
Loading…
Reference in New Issue