summaryrefslogtreecommitdiff
path: root/trove
diff options
context:
space:
mode:
authorHirotaka Wakabayashi <hiwkby@yahoo.com>2022-03-09 21:17:11 +0900
committerHirotaka Wakabayashi <hiwkby@yahoo.com>2022-03-17 09:04:45 +0900
commit559d6255e5feb73b90468a25a8ba99650ad50bf2 (patch)
tree54cad30f10833c3280b2ee5509aa3b58525b5e12 /trove
parent39322f5ad88cf5eef003af74294676a5563a8296 (diff)
downloadtrove-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
Diffstat (limited to 'trove')
-rw-r--r--trove/common/policies/base.py2
-rw-r--r--trove/common/wsgi.py2
-rw-r--r--trove/taskmanager/manager.py2
-rw-r--r--trove/tests/unittests/backup/test_backup_models.py2
-rw-r--r--trove/tests/unittests/common/test_context.py6
5 files changed, 7 insertions, 7 deletions
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))