Merge "Ensure that decomposed plugins do not break"
This commit is contained in:
commit
e811983b2d
@ -15,11 +15,14 @@
|
|||||||
|
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
|
from debtcollector import removals
|
||||||
import six
|
import six
|
||||||
from sqlalchemy import and_
|
from sqlalchemy import and_
|
||||||
from sqlalchemy import or_
|
from sqlalchemy import or_
|
||||||
from sqlalchemy import sql
|
from sqlalchemy import sql
|
||||||
|
|
||||||
|
from neutron._i18n import _
|
||||||
|
from neutron.common import exceptions as n_exc
|
||||||
from neutron.db import sqlalchemyutils
|
from neutron.db import sqlalchemyutils
|
||||||
|
|
||||||
|
|
||||||
@ -167,6 +170,18 @@ 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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user