Make RBAC entry removal enginefacade friendly

The previous approach of deleting the record and then expiring
the rbac_entries relationship was triggering a refresh from the
DB during make_network_dict. This pattern will break once we switch
to the new enginefacade so this patch just adjusts the logic to
remove the entry via the relationship.

Partially-Implements blueprint: enginefacade-switch

Change-Id: I74c88f98c1f5af4d505d17967d1c15745fe225ec
This commit is contained in:
Kevin Benton 2017-03-30 01:23:43 -07:00
parent 9364f58ec5
commit e022c1a182

View File

@ -388,8 +388,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
target_tenant='*', tenant_id=network['tenant_id'])
context.session.add(entry)
elif not update_shared and entry:
context.session.delete(entry)
context.session.expire(network, ['rbac_entries'])
network.rbac_entries.remove(entry)
# The filter call removes attributes from the body received from
# the API that are logically tied to network resources but are
# stored in other database tables handled by extensions