diff --git a/senlin/common/context.py b/senlin/common/context.py index d9cb8a2f4..5f58774a9 100644 --- a/senlin/common/context.py +++ b/senlin/common/context.py @@ -92,7 +92,6 @@ class RequestContext(context.RequestContext): 'auth_url': self.auth_url, 'auth_token': self.auth_token, 'auth_token_info': self.auth_token_info, - 'user': self.user, 'username': self.username, 'user_id': self.user_id, 'password': self.password, diff --git a/senlin/engine/service.py b/senlin/engine/service.py index c869825a7..d01622a32 100644 --- a/senlin/engine/service.py +++ b/senlin/engine/service.py @@ -424,7 +424,7 @@ class EngineService(service.Service): LOG.info(_LI('Creating cluster %s'), name) ctx = context.to_dict() kwargs = { - 'user': ctx.get('username', ''), + 'user': ctx.get('user_id', ''), 'project': ctx.get('tenant_id', ''), 'parent': parent, 'timeout': timeout, diff --git a/senlin/tests/common/utils.py b/senlin/tests/common/utils.py index 508c4545f..358fff1d4 100644 --- a/senlin/tests/common/utils.py +++ b/senlin/tests/common/utils.py @@ -65,7 +65,7 @@ def reset_dummy_db(): def dummy_context(user='test_username', tenant_id='test_tenant_id', - password='password', roles=None, user_id=None, + password='password', roles=None, user_id='test_user_id', trust_id=None, region_name=None): roles = roles or [] return context.RequestContext.from_dict({ diff --git a/senlin/tests/db/shared.py b/senlin/tests/db/shared.py index f764b2aaa..fc216335c 100644 --- a/senlin/tests/db/shared.py +++ b/senlin/tests/db/shared.py @@ -61,7 +61,7 @@ def create_cluster(ctx, profile, **kwargs): values = { 'name': 'db_test_cluster_name', 'profile_id': profile.id, - 'user': ctx.user, + 'user': ctx.user_id, 'project': ctx.tenant_id, 'domain': 'unknown', 'parent': None, @@ -103,7 +103,7 @@ def create_node(ctx, cluster, profile, **kwargs): def create_webhook(ctx, obj_id, obj_type, action, **kwargs): values = { 'name': 'test_webhook_name', - 'user': ctx.user, + 'user': ctx.user_id, 'project': ctx.tenant_id, 'domain': ctx.domain, 'created_time': None, diff --git a/senlin/tests/db/test_cluster_api.py b/senlin/tests/db/test_cluster_api.py index 9c4b766d9..270a033fe 100644 --- a/senlin/tests/db/test_cluster_api.py +++ b/senlin/tests/db/test_cluster_api.py @@ -35,7 +35,7 @@ class DBAPIClusterTest(base.SenlinTestCase): self.assertIsNotNone(cluster.id) self.assertEqual('db_test_cluster_name', cluster.name) self.assertEqual(self.profile.id, cluster.profile_id) - self.assertEqual(self.ctx.username, cluster.user) + self.assertEqual(self.ctx.user_id, cluster.user) self.assertEqual(self.ctx.tenant_id, cluster.project) self.assertEqual('unknown', cluster.domain) self.assertIsNone(cluster.parent) diff --git a/senlin/tests/db/test_webhook_api.py b/senlin/tests/db/test_webhook_api.py index 38a620090..c53fcd6b0 100644 --- a/senlin/tests/db/test_webhook_api.py +++ b/senlin/tests/db/test_webhook_api.py @@ -38,7 +38,7 @@ class DBAPIWebhookTest(base.SenlinTestCase): self.assertIsNotNone(webhook) self.assertEqual(UUID1, webhook.obj_id) self.assertEqual('test_webhook_name', webhook.name) - self.assertEqual(self.ctx.user, webhook.user) + self.assertEqual(self.ctx.user_id, webhook.user) self.assertEqual(self.ctx.domain, webhook.domain) self.assertEqual(self.ctx.tenant_id, webhook.project) self.assertIsNone(webhook.created_time) diff --git a/senlin/tests/engine/test_clusters.py b/senlin/tests/engine/test_clusters.py index 48e079740..0161f05d7 100644 --- a/senlin/tests/engine/test_clusters.py +++ b/senlin/tests/engine/test_clusters.py @@ -66,7 +66,7 @@ class ClusterTest(base.SenlinTestCase): self.assertEqual('c-1', result['name']) self.assertEqual(0, result['size']) self.assertEqual(self.profile['id'], result['profile_id']) - self.assertEqual(self.ctx.user, result['user']) + self.assertEqual(self.ctx.user_id, result['user']) self.assertEqual('cluster_test_tenant', result['project']) self.assertIsNone(result['parent']) self.assertIsNone(result['timeout']) diff --git a/senlin/tests/test_common_context.py b/senlin/tests/test_common_context.py index 4636a4639..2904a4c86 100644 --- a/senlin/tests/test_common_context.py +++ b/senlin/tests/test_common_context.py @@ -33,7 +33,6 @@ class TestRequestContext(base.SenlinTestCase): 'project_domain_id': 'a project domain', 'project_id': 'a project', 'is_admin': False, - 'user': 'mick', 'user_domain_id': 'user-domain', 'password': 'foo', 'show_deleted': False, @@ -56,7 +55,6 @@ class TestRequestContext(base.SenlinTestCase): project_domain_id=self.ctx.get('project_domain_id'), project_id=self.ctx.get('project_id'), is_admin=self.ctx.get('is_admin'), - user=self.ctx.get('user'), user_domain_id=self.ctx.get('user_domain_id'), password=self.ctx.get('password'), show_deleted=self.ctx.get('show_deleted'), @@ -129,7 +127,6 @@ class RequestContextMiddlewareTest(base.SenlinTestCase): 'show_deleted': False, 'tenant': None, 'tenant_id': None, - 'user': None, 'user_id': None, 'username': None }) @@ -158,7 +155,6 @@ class RequestContextMiddlewareTest(base.SenlinTestCase): 'show_deleted': False, 'tenant': 'my_tenant', 'tenant_id': 'db6808c8-62d0-4d92-898c-d644a6af20e9', - 'user': 'my_username', 'user_id': '7a87ff18-31c6-45ce-a186-ec7987f488c3', 'username': 'my_username' }) @@ -185,7 +181,6 @@ class RequestContextMiddlewareTest(base.SenlinTestCase): 'show_deleted': False, 'tenant': 'my_tenant2', 'tenant_id': 'bb9108c8-62d0-4d92-898c-d644a6af20e9', - 'user': None, 'user_id': '7a87ff18-31c6-45ce-a186-ec7987f488c3', 'username': None })