From 3e33fddff0a9a720699dd433ce07272baab454ba Mon Sep 17 00:00:00 2001 From: Luka Peschke Date: Wed, 9 Jan 2019 15:49:02 +0100 Subject: [PATCH] Explicitly specify the region_name when instanciating a client Until now, the region_name was not specified when instanciating cloudkittyclient from the horizon dashboard. This caused the client to use systematically use the default region. That behavior was problematic in multi-region setups, as only the cloudkitty API of the default region could be reached. Change-Id: Ibb399a0b5b96aa808b0bbb7a5a82dd4d8a948063 --- cloudkittydashboard/api/cloudkitty.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cloudkittydashboard/api/cloudkitty.py b/cloudkittydashboard/api/cloudkitty.py index ac07423..56785ca 100644 --- a/cloudkittydashboard/api/cloudkitty.py +++ b/cloudkittydashboard/api/cloudkitty.py @@ -35,11 +35,18 @@ def cloudkittyclient(request): project_id=request.user.project_id, domain_id=request.user.domain_id, ) + + adapter_options = { + 'region_name': request.user.services_region, + } + return ck_client.Client( '1', auth=auth, cacert=cacert, - insecure=insecure) + insecure=insecure, + adapter_options=adapter_options, + ) def identify(what, name=False, key=None):