From 6c10123aa1538801c01d20f659197918967a9b7f Mon Sep 17 00:00:00 2001 From: gcalvino Date: Tue, 10 Apr 2018 00:04:16 +0200 Subject: [PATCH] Region Name and endpoint type as parameters Signed-off-by: gcalvino --- osm_mon/core/auth.py | 8 ++++++++ osm_mon/plugins/OpenStack/common.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osm_mon/core/auth.py b/osm_mon/core/auth.py index 7b61fe1..6f5e20a 100644 --- a/osm_mon/core/auth.py +++ b/osm_mon/core/auth.py @@ -42,6 +42,14 @@ class AuthManager: credentials.password = creds_dict['vim_password'] credentials.tenant_name = creds_dict['vim_tenant_name'] credentials.config = json.dumps(creds_dict['config']) + if creds_dict.get('OS_REGION_NAME'): + credentials.region_name = creds_dict['OS_REGION_NAME'] + else: + credentials.region_name = "RegionOne" + if creds_dict.get('OS_ENDPOINT_TYPE'): + credentials.endpoint_type = creds_dict['OS_ENDPOINT_TYPE'] + else: + credentials.endpoint_type = "publicURL" self.database_manager.save_credentials(credentials) def get_credentials(self, vim_uuid): diff --git a/osm_mon/plugins/OpenStack/common.py b/osm_mon/plugins/OpenStack/common.py index 57acf40..2540a3f 100644 --- a/osm_mon/plugins/OpenStack/common.py +++ b/osm_mon/plugins/OpenStack/common.py @@ -62,8 +62,8 @@ class Common(object): tenant_name=creds.tenant_name) return ks.service_catalog.url_for( service_type=service_type, - endpoint_type='publicURL', - region_name='RegionOne') + endpoint_type=creds.endpoint_type, + region_name=creds.region_name) @staticmethod def perform_request(url, auth_token, -- 2.25.1