From 17991ab22e2136a99eb6883e49352ba24d3dea8f Mon Sep 17 00:00:00 2001 From: huangtianhua Date: Thu, 27 Aug 2015 11:29:04 +0800 Subject: [PATCH] Set correct tenant id when python-client init If tenant name with chinese characters, an 'UnicodeEncodeError' exception raised when the tenant creating a stack with a nova server. To set correct tenant id instead of tenant name when novaclient init is the best way to avoid this problem. Also this patch fix this problem for glanceclient and cinderclient. Change-Id: Ifc8ab70c69453344156d25aba4291769bb7fe117 Closes-Bug: #1488881 --- heat/engine/clients/os/cinder.py | 2 +- heat/engine/clients/os/glance.py | 2 +- heat/engine/clients/os/nova.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/heat/engine/clients/os/cinder.py b/heat/engine/clients/os/cinder.py index 961ae5e8d..1ba7d6dc9 100644 --- a/heat/engine/clients/os/cinder.py +++ b/heat/engine/clients/os/cinder.py @@ -70,7 +70,7 @@ class CinderClientPlugin(client_plugin.ClientPlugin): args = { 'service_type': service_type, 'auth_url': con.auth_url or '', - 'project_id': con.tenant, + 'project_id': con.tenant_id, 'username': None, 'api_key': None, 'endpoint_type': endpoint_type, diff --git a/heat/engine/clients/os/glance.py b/heat/engine/clients/os/glance.py index 8c69bed80..af9120b13 100644 --- a/heat/engine/clients/os/glance.py +++ b/heat/engine/clients/os/glance.py @@ -40,7 +40,7 @@ class GlanceClientPlugin(client_plugin.ClientPlugin): args = { 'auth_url': con.auth_url, 'service_type': self.IMAGE, - 'project_id': con.tenant, + 'project_id': con.tenant_id, 'token': self.auth_token, 'endpoint_type': endpoint_type, 'cacert': self._get_client_option('glance', 'ca_file'), diff --git a/heat/engine/clients/os/nova.py b/heat/engine/clients/os/nova.py index b745406c8..22a923b78 100644 --- a/heat/engine/clients/os/nova.py +++ b/heat/engine/clients/os/nova.py @@ -66,7 +66,7 @@ class NovaClientPlugin(client_plugin.ClientPlugin): extensions = nc.discover_extensions(NOVACLIENT_VERSION) args = { - 'project_id': self.context.tenant, + 'project_id': self.context.tenant_id, 'auth_url': self.context.auth_url, 'auth_token': self.auth_token, 'service_type': self.COMPUTE,