From: Gary Kotton Date: Sat, 18 Jul 2015 07:33:10 +0000 (-0700) Subject: Validate that context exists X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ce437729f9ac552939c5473c8c8fee52d214c8db;p=openstack-build%2Fneutron-build.git Validate that context exists Commit 3e0328b992d8a90213a56ec5a4144677279bea66 broke external decomposed plugins due to the fact that it assumes that the context is set. This patch validates that the context is set. Co-Authored-By: Kevin Benton Change-Id: I3320f27be7b0fed1d3b37a5c5459d91b2bc4f13b Closes-bug: #1475837 --- diff --git a/neutron/db/db_base_plugin_common.py b/neutron/db/db_base_plugin_common.py index 8661ec589..54257ed97 100644 --- a/neutron/db/db_base_plugin_common.py +++ b/neutron/db/db_base_plugin_common.py @@ -223,9 +223,10 @@ class DbBasePluginCommon(common_db_mixin.CommonDbMixin): # The shared attribute for a network now reflects if the network # is shared to the calling tenant via an RBAC entry. shared = False + matches = ('*',) + ((context.tenant_id,) if context else ()) for entry in network.rbac_entries: if (entry.action == 'access_as_shared' and - entry.target_tenant in ('*', context.tenant_id)): + entry.target_tenant in matches): shared = True break res['shared'] = shared