From e7d3454c2d0c0b710d8f97433d4fb7a9d66053e4 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Mon, 2 Jun 2014 18:52:04 +0200 Subject: [PATCH] Support of regional endpoinds using Keystone v2 Handles the configuration region_name_for_services with the keystone V2 authentication. Change-Id: Ibba4d617937da8ba6018471e9614259e90409a47 --- .../heat_keystoneclient_v2/heat_keystoneclient_v2/client.py | 3 ++- .../heat_keystoneclient_v2/tests/test_client.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py b/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py index b1981bd1e..e51c96d17 100644 --- a/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py +++ b/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/client.py @@ -64,7 +64,8 @@ class KeystoneClientV2(object): def _v2_client_init(self): kwargs = { - 'auth_url': self.context.auth_url + 'auth_url': self.context.auth_url, + 'region': cfg.CONF.region_name_for_services } auth_kwargs = {} # Note try trust_id first, as we can't reuse auth_token in that case diff --git a/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/tests/test_client.py b/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/tests/test_client.py index df5fbee11..3b0baf90a 100644 --- a/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/tests/test_client.py +++ b/contrib/heat_keystoneclient_v2/heat_keystoneclient_v2/tests/test_client.py @@ -58,6 +58,7 @@ class KeystoneClientTest(HeatTestCase): cacert=None, cert=None, insecure=False, + region=None, key=None).AndReturn(self.mock_ks_client) self.mock_ks_client.authenticate().AndReturn(auth_ok) elif method == 'password': @@ -70,6 +71,7 @@ class KeystoneClientTest(HeatTestCase): cacert=None, cert=None, insecure=False, + region=None, key=None).AndReturn(self.mock_ks_client) self.mock_ks_client.authenticate().AndReturn(auth_ok) if method == 'trust': @@ -81,6 +83,7 @@ class KeystoneClientTest(HeatTestCase): cacert=None, cert=None, insecure=False, + region=None, key=None).AndReturn(self.mock_ks_client) self.mock_ks_client.authenticate(trust_id='atrust123', tenant_id='test_tenant_id'