Browse Source

Deprecate usage of tenant and user in context

Update usage of tenant to project_id and user to user_id when handling context
fields. This drops deprecation warnings.

Change-Id: I8001be34bcc25678ed99b6b6717ad170ae6d2d77
changes/63/532463/5
Ricardo Rocha 4 years ago
committed by Spyros Trigazis (strigazi)
parent
commit
c57bc86384
  1. 2
      magnum/common/context.py
  2. 2
      magnum/drivers/mesos_ubuntu_v1/template_def.py
  3. 2
      magnum/tests/unit/common/test_context.py
  4. 2
      magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py
  5. 2
      magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py
  6. 2
      magnum/tests/unit/drivers/test_template_definition.py

2
magnum/common/context.py

@ -41,7 +41,7 @@ class RequestContext(context.RequestContext):
"""
super(RequestContext, self).__init__(auth_token=auth_token,
user=user_name,
user_id=user_name,
tenant=project_name,
is_admin=is_admin,
read_only=read_only,

2
magnum/drivers/mesos_ubuntu_v1/template_def.py

@ -58,7 +58,7 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
osc = self.get_osc(context)
extra_params['auth_url'] = context.auth_url
extra_params['username'] = context.user_name
extra_params['tenant_name'] = context.tenant
extra_params['tenant_name'] = context.project_id
extra_params['domain_name'] = context.domain_name
extra_params['region_name'] = osc.cinder_region_name()

2
magnum/tests/unit/common/test_context.py

@ -84,7 +84,7 @@ class ContextTestCase(base.TestCase):
self.assertEqual(ctx.domain_name, ctx2.domain_name)
self.assertEqual(ctx.user_name, ctx2.user_name)
self.assertEqual(ctx.user_id, ctx2.user_id)
self.assertEqual(ctx.tenant, ctx2.tenant)
self.assertEqual(ctx.project_id, ctx2.project_id)
self.assertEqual(ctx.project_name, ctx2.project_name)
self.assertEqual(ctx.project_id, ctx2.project_id)
self.assertEqual(ctx.is_admin, ctx2.is_admin)

2
magnum/tests/unit/conductor/handlers/test_k8s_cluster_conductor.py

@ -100,7 +100,7 @@ class TestClusterConductorWithK8s(base.TestCase):
'flavor_id': 'flavor_id',
}
self.context.user_name = 'fake_user'
self.context.tenant = 'fake_tenant'
self.context.project_id = 'fake_tenant'
osc_patcher = mock.patch('magnum.common.clients.OpenStackClients')
self.mock_osc_class = osc_patcher.start()
self.addCleanup(osc_patcher.stop)

2
magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py

@ -77,7 +77,7 @@ class TestClusterConductorWithMesos(base.TestCase):
},
}
self.context.user_name = 'mesos_user'
self.context.tenant = 'admin'
self.context.project_id = 'admin'
self.context.domain_name = 'domainname'
osc_patcher = mock.patch('magnum.common.clients.OpenStackClients')
self.mock_osc_class = osc_patcher.start()

2
magnum/tests/unit/drivers/test_template_definition.py

@ -928,7 +928,7 @@ class UbuntuMesosTemplateDefinitionTestCase(base.TestCase):
mock_context = mock.MagicMock()
mock_context.auth_url = 'http://192.168.10.10:5000/v3'
mock_context.user_name = 'mesos_user'
mock_context.tenant = 'admin'
mock_context.project_id = 'admin'
mock_context.domain_name = 'domainname'
mock_cluster_template = mock.MagicMock()
mock_cluster_template.tls_disabled = False

Loading…
Cancel
Save