]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Make models_v2 explicitly import rbac_db_models
authorKevin Benton <blak111@gmail.com>
Mon, 24 Aug 2015 10:13:14 +0000 (03:13 -0700)
committerKevin Benton <blak111@gmail.com>
Mon, 24 Aug 2015 10:13:14 +0000 (03:13 -0700)
commit2ef027ed39e0398f2dbdd63b09a6a0279d6bc6c4
tree64cc6a127db80d29d1d50c2cdf35af4cd6568642
parent40576ae09ca0b54a665516215e2774a5c04bc90a
Make models_v2 explicitly import rbac_db_models

The Network model was implicitly relying on a core plugin to import
the db_base_plugin_v2 module which would import the rbac model module
so "NetworkRBAC" would be defined by the time something would query
the DB. However, this isn't the case for scripts or agents that are
importing models_v2 and trying to query the DB directly so they will
now break with an sqlaclhemy error about a missing model.

This patch makes models_v2 import the rbac_db_models module directly
so the model will always be defined.

This would have resulted in a circular import because the
rbac_db_models module required the HasId and HasTenant classes
in models_v2. So this patch also moves these helper classes
into model_base.

Change-Id: I338ce1c0ba55647e6410a63f937737f75a63057d
Closes-Bug: #1488032
neutron/db/model_base.py
neutron/db/models_v2.py
neutron/db/rbac_db_models.py