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
This commit is contained in:
Sean McGinnis 2017-11-21 14:56:06 -06:00
parent ab5dfc096e
commit 82447a26b5
4 changed files with 10 additions and 10 deletions

View File

@ -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,

View File

@ -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.

View File

@ -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"])

View File

@ -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)