From ad79106093f0ef7f85df8b1fdd490e0c7a5a0df1 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Tue, 26 Mar 2013 17:11:47 +1300 Subject: [PATCH] Fix swift client token authentication Triggered by launching a stack containing swift containers through Horizon. The swift client does its own endpoint lookup if we don't know it, so we don't have to do it ourselves. Also, our endpoint lookup was broken in the auth_token codepath. Part of blueprint auth-token-only Change-Id: I1876f233001a58cb17e7dd7d5cf8883e295a9b87 --- heat/engine/clients.py | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/heat/engine/clients.py b/heat/engine/clients.py index e2ac0739..9b30581f 100644 --- a/heat/engine/clients.py +++ b/heat/engine/clients.py @@ -120,34 +120,24 @@ class OpenStackClients(object): con = self.context args = { - 'auth_version': '2' + 'auth_version': '2', + 'tenant_name': con.tenant, + 'authurl': con.auth_url, + 'user': con.username } if con.password is not None: - args['user'] = con.username args['key'] = con.password - args['authurl'] = con.auth_url - args['tenant_name'] = con.tenant elif con.auth_token is not None: - args['user'] = None - args['key'] = None - args['authurl'] = None - args['preauthtoken'] = con.auth_token - # Lookup endpoint for object-store service type - service_type = 'object-store' - endpoints = self.keystone().service_catalog.get_endpoints( - service_type=service_type) - if len(endpoints[service_type]) == 1: - args['preauthurl'] = endpoints[service_type][0]['publicURL'] - else: - logger.error("No endpoint found for %s service type" % - service_type) - return None + args['os_options'] = { + 'tenant_id': con.tenant_id, + 'auth_token': con.auth_token, + 'tenant_name': con.tenant + } else: logger.error("Swift connection failed, no password or " + "auth_token!") return None - self._swift = swiftclient.Connection(**args) return self._swift -- 2.45.2