Remove temporary local HasProject
Now that the tenant_id rename has merged in Neutron we can remove the temporary work-around. Also switch from the deprecated models_v2.HasId to the relocated model_base.HasId Related Blueprint: keystone-v3 Change-Id: I83c04e3455deade9ed1dda823d1a321579fba808
This commit is contained in:
1 changed files with 4 additions and 32 deletions
@@ -17,14 +17,12 @@ from oslo_db import exception as db_exc
from oslo_log import log
from oslo_utils import uuidutils
import sqlalchemy as sa
from sqlalchemy.ext import declarative
from sqlalchemy import orm
from sqlalchemy.orm import exc
from neutron.api.v2 import attributes as attr
from neutron.db import common_db_mixin
from neutron.db import model_base
from neutron.db import models_v2
from networking_bgpvpn._i18n import _LI
from networking_bgpvpn._i18n import _LW
@@ -34,39 +32,13 @@ from networking_bgpvpn.neutron.services.common import utils
LOG = log.getLogger(__name__)
class HasProject(object):
# NOTE(dasm): Temporary solution!
# Remove when I87a8ef342ccea004731ba0192b23a8e79bc382dc is merged.
# NOTE(jkoelker) project_id is just a free form string ;(
project_id = sa.Column(sa.String(attr.TENANT_ID_MAX_LEN), index=True)
def __init__(self, *args, **kwargs):
# NOTE(dasm): debtcollector requires init in class
super(HasProject, self).__init__(*args, **kwargs)
def get_tenant_id(self):
return self.project_id
def set_tenant_id(self, value):
self.project_id = value
@declarative.declared_attr
def tenant_id(cls):
return orm.synonym(
'project_id',
descriptor=property(cls.get_tenant_id, cls.set_tenant_id))
class HasProjectNotNullable(HasProject):
# NOTE(dasm): Temporary solution!
# Remove when I87a8ef342ccea004731ba0192b23a8e79bc382dc is merged.
class HasProjectNotNullable(model_base.HasProject):
project_id = sa.Column(sa.String(attr.TENANT_ID_MAX_LEN), index=True,
nullable=False)
class BGPVPNNetAssociation(model_base.BASEV2, models_v2.HasId,
class BGPVPNNetAssociation(model_base.BASEV2, model_base.HasId,
HasProjectNotNullable):
"""Represents the association between a bgpvpn and a network."""
__tablename__ = 'bgpvpn_network_associations'
@@ -84,7 +56,7 @@ class BGPVPNNetAssociation(model_base.BASEV2, models_v2.HasId,
lazy='joined',)
class BGPVPNRouterAssociation(model_base.BASEV2, models_v2.HasId,
class BGPVPNRouterAssociation(model_base.BASEV2, model_base.HasId,
HasProjectNotNullable):
"""Represents the association between a bgpvpn and a router."""
__tablename__ = 'bgpvpn_router_associations'
@@ -102,7 +74,7 @@ class BGPVPNRouterAssociation(model_base.BASEV2, models_v2.HasId,
lazy='joined',)
class BGPVPN(model_base.BASEV2, models_v2.HasId, HasProject):
class BGPVPN(model_base.BASEV2, model_base.HasId, model_base.HasProject):
"""Represents a BGPVPN Object."""
name = sa.Column(sa.String(255))
type = sa.Column(sa.Enum("l2", "l3",
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.