Skip to content

Commit

Permalink
Update oslo.context RequestContext args
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stmcginnis committed Nov 21, 2017
1 parent ab5dfc0 commit 82447a2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cinder/compute/nova.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions cinder/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def from_dict(cls, values):
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'),
Expand All @@ -145,8 +145,8 @@ def from_dict(cls, values):
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.
Expand Down
6 changes: 3 additions & 3 deletions cinder/tests/unit/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def test_service_catalog_nova_and_swift(self):

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

Expand Down
6 changes: 3 additions & 3 deletions cinder/tests/unit/test_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def test_get_test_admin_context(self):

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)
Expand Down

0 comments on commit 82447a2

Please sign in to comment.