From 82447a26b5a17cebf6274d6c53f4a84f455856bd Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 21 Nov 2017 14:56:06 -0600 Subject: [PATCH] Update oslo.context RequestContext args Commit I9272f71e0e68268ad9f558ddd1e1183e3ea69806 fixed a few deprecation warnings due to properties being renamed in oslo context, but there were a few other name changes as well. This updates domain_id, project_domain_id, and user_domain_id and gets rid of ~130 DeprecationWarning messages from our unit test runs. Change-Id: Ic7e8e6bc5c68e73a2c26c3105885e5c6ea06a4a8 --- cinder/compute/nova.py | 2 +- cinder/context.py | 6 +++--- cinder/tests/unit/test_context.py | 6 +++--- cinder/tests/unit/test_test_utils.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cinder/compute/nova.py b/cinder/compute/nova.py index 7a014d7c38f..bd264405f2f 100644 --- a/cinder/compute/nova.py +++ b/cinder/compute/nova.py @@ -105,7 +105,7 @@ def novaclient(context, privileged_user=False, timeout=None, api_version=None): n_auth = identity.Token(auth_url=url, token=context.auth_token, project_name=context.project_name, - project_domain_id=context.project_domain) + project_domain_id=context.project_domain_id) keystone_session = ks_loading.load_session_from_conf_options( CONF, diff --git a/cinder/context.py b/cinder/context.py index 3e484ed02aa..a5b1d79bc56 100644 --- a/cinder/context.py +++ b/cinder/context.py @@ -135,7 +135,7 @@ class RequestContext(context.RequestContext): return cls(user_id=values.get('user_id'), project_id=values.get('project_id'), project_name=values.get('project_name'), - domain=values.get('domain_id'), + domain_id=values.get('domain_id'), read_deleted=values.get('read_deleted'), remote_address=values.get('remote_address'), timestamp=values.get('timestamp'), @@ -145,8 +145,8 @@ class RequestContext(context.RequestContext): is_admin=values.get('is_admin'), roles=values.get('roles'), auth_token=values.get('auth_token'), - user_domain=values.get('user_domain'), - project_domain=values.get('project_domain')) + user_domain_id=values.get('user_domain_id'), + project_domain_id=values.get('project_domain_id')) def authorize(self, action, target=None, target_obj=None, fatal=True): """Verifies that the given action is valid on the target in this context. diff --git a/cinder/tests/unit/test_context.py b/cinder/tests/unit/test_context.py index 68f89282df4..1df972c9d6d 100644 --- a/cinder/tests/unit/test_context.py +++ b/cinder/tests/unit/test_context.py @@ -94,9 +94,9 @@ class ContextTestCase(test.TestCase): def test_user_identity(self): ctx = context.RequestContext("user", "tenant", - domain="domain", - user_domain="user-domain", - project_domain="project-domain") + domain_id="domain", + user_domain_id="user-domain", + project_domain_id="project-domain") self.assertEqual('user tenant domain user-domain project-domain', ctx.to_dict()["user_identity"]) diff --git a/cinder/tests/unit/test_test_utils.py b/cinder/tests/unit/test_test_utils.py index ae3606eb25b..c19f8cd0b5d 100644 --- a/cinder/tests/unit/test_test_utils.py +++ b/cinder/tests/unit/test_test_utils.py @@ -24,9 +24,9 @@ class TestUtilsTestCase(test.TestCase): self.assertIsNone(ctxt.project_id) self.assertIsNone(ctxt.user_id) - self.assertIsNone(ctxt.domain) - self.assertIsNone(ctxt.project_domain) - self.assertIsNone(ctxt.user_domain) + self.assertIsNone(ctxt.domain_id) + self.assertIsNone(ctxt.project_domain_id) + self.assertIsNone(ctxt.user_domain_id) self.assertIsNone(ctxt.project_name) self.assertIsNone(ctxt.remote_address) self.assertIsNone(ctxt.auth_token)