diff --git a/neutron/context.py b/neutron/context.py index 5f3d26e58fe..3076ae2491f 100644 --- a/neutron/context.py +++ b/neutron/context.py @@ -18,7 +18,6 @@ import copy import datetime -from debtcollector import removals from oslo_context import context as oslo_context from oslo_log import log as logging @@ -36,7 +35,6 @@ class ContextBase(oslo_context.RequestContext): """ - @removals.removed_kwarg('read_deleted') def __init__(self, user_id, tenant_id, is_admin=None, roles=None, timestamp=None, request_id=None, tenant_name=None, user_name=None, overwrite=True, auth_token=None, @@ -105,8 +103,7 @@ class ContextBase(oslo_context.RequestContext): def from_dict(cls, values): return cls(**values) - @removals.removed_kwarg('read_deleted') - def elevated(self, read_deleted=None): + def elevated(self): """Return a version of this context with admin flag set.""" context = copy.copy(self) context.is_admin = True @@ -129,17 +126,14 @@ class Context(ContextBase): return self._session -@removals.removed_kwarg('read_deleted') -@removals.removed_kwarg('load_admin_roles') -def get_admin_context(read_deleted="no", load_admin_roles=True): +def get_admin_context(): return Context(user_id=None, tenant_id=None, is_admin=True, overwrite=False) -@removals.removed_kwarg('read_deleted') -def get_admin_context_without_session(read_deleted="no"): +def get_admin_context_without_session(): return ContextBase(user_id=None, tenant_id=None, is_admin=True) diff --git a/neutron/tests/unit/db/quota/test_api.py b/neutron/tests/unit/db/quota/test_api.py index ea8b2aeeaa9..15647f91613 100644 --- a/neutron/tests/unit/db/quota/test_api.py +++ b/neutron/tests/unit/db/quota/test_api.py @@ -303,8 +303,7 @@ class TestQuotaDbApiAdminContext(TestQuotaDbApi): def _set_context(self): self.tenant_id = 'Higuain' self.context = context.Context('Gonzalo', self.tenant_id, - is_admin=True, is_advsvc=True, - load_admin_roles=False) + is_admin=True, is_advsvc=True) def test_get_quota_usage_by_resource(self): self._create_quota_usage('goals', 26) diff --git a/neutron/tests/unit/db/test_db_base_plugin_v2.py b/neutron/tests/unit/db/test_db_base_plugin_v2.py index dea0296ac20..b9332976b3f 100644 --- a/neutron/tests/unit/db/test_db_base_plugin_v2.py +++ b/neutron/tests/unit/db/test_db_base_plugin_v2.py @@ -3749,7 +3749,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase): def _test_validate_subnet_ipv6_pd_modes(self, cur_subnet=None, expect_success=True, **modes): plugin = manager.NeutronManager.get_plugin() - ctx = context.get_admin_context(load_admin_roles=False) + ctx = context.get_admin_context() new_subnet = {'ip_version': 6, 'cidr': constants.PROVISIONAL_IPV6_PD_PREFIX, 'enable_dhcp': True, diff --git a/neutron/tests/unit/extensions/test_quotasv2.py b/neutron/tests/unit/extensions/test_quotasv2.py index 8e0e55b3462..e547920ca9f 100644 --- a/neutron/tests/unit/extensions/test_quotasv2.py +++ b/neutron/tests/unit/extensions/test_quotasv2.py @@ -348,7 +348,7 @@ class QuotaExtensionDbTestCase(QuotaExtensionTestCase): tenant_id = 'tenant_id1' self.assertRaises(exceptions.QuotaResourceUnknown, quota.QUOTAS.make_reservation, - context.get_admin_context(load_admin_roles=False), + context.get_admin_context(), tenant_id, {'foobar': 1}, plugin=None) @@ -357,7 +357,7 @@ class QuotaExtensionDbTestCase(QuotaExtensionTestCase): tenant_id = 'tenant_id1' self.assertRaises(exceptions.InvalidQuotaValue, quota.QUOTAS.make_reservation, - context.get_admin_context(load_admin_roles=False), + context.get_admin_context(), tenant_id, {'network': -1}, plugin=None)