From ce437729f9ac552939c5473c8c8fee52d214c8db Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Sat, 18 Jul 2015 00:33:10 -0700 Subject: [PATCH] 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 --- neutron/db/db_base_plugin_common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.45.2