DB: remove method _get_tenant_id_for_create
This method was marked as deprecated in commit 584d960a93
.
TrivialFix
Change-Id: Id753df324eb2df938fbce5a0e033768f3a11de11
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from debtcollector import removals
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
import six
|
import six
|
||||||
@@ -25,8 +24,7 @@ from sqlalchemy.ext import associationproxy
|
|||||||
from sqlalchemy import or_
|
from sqlalchemy import or_
|
||||||
from sqlalchemy import sql
|
from sqlalchemy import sql
|
||||||
|
|
||||||
from neutron._i18n import _, _LE
|
from neutron._i18n import _LE
|
||||||
from neutron.common import exceptions as n_exc
|
|
||||||
from neutron.db import sqlalchemyutils
|
from neutron.db import sqlalchemyutils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@@ -194,18 +192,6 @@ class CommonDbMixin(object):
|
|||||||
if key in fields))
|
if key in fields))
|
||||||
return resource
|
return resource
|
||||||
|
|
||||||
@removals.remove(message='This method will be removed in N')
|
|
||||||
def _get_tenant_id_for_create(self, context, resource):
|
|
||||||
if context.is_admin and 'tenant_id' in resource:
|
|
||||||
tenant_id = resource['tenant_id']
|
|
||||||
elif ('tenant_id' in resource and
|
|
||||||
resource['tenant_id'] != context.tenant_id):
|
|
||||||
reason = _('Cannot create resource for another tenant')
|
|
||||||
raise n_exc.AdminRequired(reason=reason)
|
|
||||||
else:
|
|
||||||
tenant_id = context.tenant_id
|
|
||||||
return tenant_id
|
|
||||||
|
|
||||||
def _get_by_id(self, context, model, id):
|
def _get_by_id(self, context, model, id):
|
||||||
query = self._model_query(context, model)
|
query = self._model_query(context, model)
|
||||||
return query.filter(model.id == id).one()
|
return query.filter(model.id == id).one()
|
||||||
|
Reference in New Issue
Block a user