diff --git a/requirements.txt b/requirements.txt index 668c0f998d..b9dabd20fa 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 6655f7c52f..35c9cb7e8f 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 66cff1290b..72fcfc1fab 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 ace2369711..a7a164939f 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 ffa205dd87..bc7e209ec0 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 d3f237dd95..a5f2f3a29e 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))