diff options
author | Hirotaka Wakabayashi <hiwkby@yahoo.com> | 2022-03-09 21:17:11 +0900 |
---|---|---|
committer | Hirotaka Wakabayashi <hiwkby@yahoo.com> | 2022-03-17 09:04:45 +0900 |
commit | 559d6255e5feb73b90468a25a8ba99650ad50bf2 (patch) | |
tree | 54cad30f10833c3280b2ee5509aa3b58525b5e12 | |
parent | 39322f5ad88cf5eef003af74294676a5563a8296 (diff) | |
download | trove-559d6255e5feb73b90468a25a8ba99650ad50bf2.tar.gz |
Removes the deprecated argument tenant from TroveContext
The tenant argument of RequestContext in oslo.context had been
deprecated long time ago and it was finally removed in
oslo.context-4.0.0. We should remove the tenant argument of
TroveContext that derives from RequestContext and we should also
update the requirements.txt in the master branch.
Task: 44723
Story: 2009906
Change-Id: I69c7098cc0d61fbbba1dbf2eca87df0dd6fd70ba
-rw-r--r-- | requirements.txt | 2 | ||||
-rw-r--r-- | trove/common/policies/base.py | 2 | ||||
-rw-r--r-- | trove/common/wsgi.py | 2 | ||||
-rw-r--r-- | trove/taskmanager/manager.py | 2 | ||||
-rw-r--r-- | trove/tests/unittests/backup/test_backup_models.py | 2 | ||||
-rw-r--r-- | trove/tests/unittests/common/test_context.py | 6 |
6 files changed, 8 insertions, 8 deletions
diff --git a/requirements.txt b/requirements.txt index 668c0f99..b9dabd20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,7 +28,7 @@ jsonschema>=3.2.0 # MIT Jinja2>=2.10 # BSD License (3 clause) pexpect!=3.3,>=3.1 # ISC License oslo.config>=6.8.0 # Apache-2.0 -oslo.context>=2.22.0 # Apache-2.0 +oslo.context>=4.0.0 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0 oslo.middleware>=3.31.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 diff --git a/trove/common/policies/base.py b/trove/common/policies/base.py index 6655f7c5..35c9cb7e 100644 --- a/trove/common/policies/base.py +++ b/trove/common/policies/base.py @@ -57,7 +57,7 @@ rules = [ description='Must be an administrator.'), policy.RuleDefault( 'admin_or_owner', - 'rule:admin or tenant:%(tenant)s', + 'rule:admin or project_id:%(tenant)s', description='Must be an administrator or owner of the object.'), policy.RuleDefault( 'default', diff --git a/trove/common/wsgi.py b/trove/common/wsgi.py index 66cff129..72fcfc1f 100644 --- a/trove/common/wsgi.py +++ b/trove/common/wsgi.py @@ -548,7 +548,7 @@ class ContextMiddleware(base_wsgi.Middleware): break limits = self._extract_limits(request.params) context = rd_context.TroveContext(auth_token=auth_token, - tenant=tenant_id, + project_id=tenant_id, user=user_id, is_admin=is_admin, limit=limits.get('limit'), diff --git a/trove/taskmanager/manager.py b/trove/taskmanager/manager.py index ace23697..a7a16493 100644 --- a/trove/taskmanager/manager.py +++ b/trove/taskmanager/manager.py @@ -45,7 +45,7 @@ class Manager(periodic_task.PeriodicTasks): super(Manager, self).__init__(CONF) self.admin_context = TroveContext( user=CONF.service_credentials.username, - tenant=CONF.service_credentials.project_id, + project_id=CONF.service_credentials.project_id, user_domain_name=CONF.service_credentials.user_domain_name) if CONF.exists_notification_transformer: self.exists_transformer = importutils.import_object( diff --git a/trove/tests/unittests/backup/test_backup_models.py b/trove/tests/unittests/backup/test_backup_models.py index ffa205dd..bc7e209e 100644 --- a/trove/tests/unittests/backup/test_backup_models.py +++ b/trove/tests/unittests/backup/test_backup_models.py @@ -33,7 +33,7 @@ from trove.tests.unittests.util import util def _prep_conf(current_time): current_time = str(current_time) - _context = context.TroveContext(tenant='TENANT-' + current_time) + _context = context.TroveContext(project_id='TENANT-' + current_time) instance_id = 'INSTANCE-' + current_time return _context, instance_id diff --git a/trove/tests/unittests/common/test_context.py b/trove/tests/unittests/common/test_context.py index d3f237dd..a5f2f3a2 100644 --- a/trove/tests/unittests/common/test_context.py +++ b/trove/tests/unittests/common/test_context.py @@ -51,7 +51,7 @@ class TestTroveContext(trove_testtools.TestCase): def test_to_dict_with_notification(self): ctx = context.TroveContext(user='test_user_id', - tenant='the_tenant', + project_id='the_tenant', request_id='test_req_id') ctx.notification = DBaaSInstanceCreate(ctx, request=Mock()) @@ -68,11 +68,11 @@ class TestTroveContext(trove_testtools.TestCase): ctx = context.TroveContext.from_dict( {'user': 'test_user_id', 'request_id': 'test_req_id', - 'tenant': 'abc', + 'project_id': 'abc', 'blah_blah': 'blah blah'}) self.assertThat(ctx.user, Equals('test_user_id')) self.assertThat(ctx.request_id, Equals('test_req_id')) - self.assertThat(ctx.tenant, Equals('abc')) + self.assertThat(ctx.project_id, Equals('abc')) self.assertThat(ctx.limit, Is(None)) self.assertThat(ctx.marker, Is(None)) self.assertThat(ctx.service_catalog, Is(None)) |