From 36f28dec45dd07691995e939e7d04708c59483f4 Mon Sep 17 00:00:00 2001 From: Jose Castro Leon Date: Tue, 24 Jul 2018 13:32:07 +0200 Subject: [PATCH] Remove hardcoded usage of v2 authentication in Barbican actions There are still some hardcoded v2 authentication in barbican actions. This api has been deprecated and removed, so we can change it to use instead v3. It also removes the version number from some helper methods. Change-Id: I0390daf841463d11cb7c61653897949989b6e6eb Closes-bug: #1783316 --- mistral/actions/openstack/actions.py | 18 +++++++++--------- mistral/utils/openstack/keystone.py | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mistral/actions/openstack/actions.py b/mistral/actions/openstack/actions.py index 9426c3ef4..510b9f795 100644 --- a/mistral/actions/openstack/actions.py +++ b/mistral/actions/openstack/actions.py @@ -581,13 +581,13 @@ class BarbicanAction(base.OpenStackAction): LOG.debug("Barbican action security context: %s", context) barbican_endpoint = keystone_utils.get_endpoint_for_project('barbican') - keystone_endpoint = keystone_utils.get_keystone_endpoint_v2() + keystone_endpoint = keystone_utils.get_keystone_endpoint() - auth = identity.v2.Token( + auth = identity.v3.Token( auth_url=keystone_endpoint.url, - tenant_name=context.user_name, + project_name=context.user_name, token=context.auth_token, - tenant_id=context.project_id + project_id=context.project_id ) return self._get_client_class()( @@ -722,7 +722,7 @@ class MagnumAction(base.OpenStackAction): LOG.debug("Magnum action security context: %s", context) - keystone_endpoint = keystone_utils.get_keystone_endpoint_v2() + keystone_endpoint = keystone_utils.get_keystone_endpoint() auth_url = keystone_endpoint.url magnum_url = keystone_utils.get_endpoint_for_project('magnum').url @@ -751,7 +751,7 @@ class MuranoAction(base.OpenStackAction): LOG.debug("Murano action security context: %s", context) - keystone_endpoint = keystone_utils.get_keystone_endpoint_v2() + keystone_endpoint = keystone_utils.get_keystone_endpoint() murano_endpoint = self.get_service_endpoint() return self._get_client_class()( @@ -779,7 +779,7 @@ class TackerAction(base.OpenStackAction): LOG.debug("Tacker action security context: %s", context) - keystone_endpoint = keystone_utils.get_keystone_endpoint_v2() + keystone_endpoint = keystone_utils.get_keystone_endpoint() tacker_endpoint = self.get_service_endpoint() return self._get_client_class()( @@ -807,7 +807,7 @@ class SenlinAction(base.OpenStackAction): LOG.debug("Senlin action security context: %s", context) - keystone_endpoint = keystone_utils.get_keystone_endpoint_v2() + keystone_endpoint = keystone_utils.get_keystone_endpoint() senlin_endpoint = self.get_service_endpoint() return self._get_client_class()( @@ -955,7 +955,7 @@ class ZunAction(base.OpenStackAction): LOG.debug("Zun action security context: %s", context) - keystone_endpoint = keystone_utils.get_keystone_endpoint_v2() + keystone_endpoint = keystone_utils.get_keystone_endpoint() zun_endpoint = self.get_service_endpoint() session_and_auth = self.get_session_and_auth(context) diff --git a/mistral/utils/openstack/keystone.py b/mistral/utils/openstack/keystone.py index f5410ac4d..a61a22c8f 100644 --- a/mistral/utils/openstack/keystone.py +++ b/mistral/utils/openstack/keystone.py @@ -248,11 +248,11 @@ def obtain_service_catalog(ctx): return service_catalog -def get_keystone_endpoint_v2(): +def get_keystone_endpoint(): return get_endpoint_for_project('keystone', service_type='identity') -def get_keystone_url_v2(): +def get_keystone_url(): return get_endpoint_for_project('keystone', service_type='identity').url