From 3b04384192301098aba2cc56831d7d25b8737433 Mon Sep 17 00:00:00 2001 From: Andy Ning Date: Thu, 30 Apr 2020 09:15:24 -0400 Subject: [PATCH] Set service's self url based on settings for Horizon The intention of the original patch is to remove Horizon's reference to internal endpoint so that the default endpoint type specified in settings (OPENSTACK_ENDPOINT_TYPE) can take effect uniformly across all services. But the patched function base.get_url_for_service() take 3 mandatory parameters. So removing the third param causes Horizon traceback when accessing API Access page. This commit updated the patch so that services's self url is set to the value of OPENSTACK_ENDPOINT_TYPE in settings (or default to "internalURL" if OPENSTACK_ENDPOINT_TYPE is not set). Change-Id: I19604d702f5f2de80dc4d0f426154fb5a0b9ad78 Closes-Bug: 1874902 Signed-off-by: Andy Ning --- ...-hard-coded-internal-URL-for-keystone.patch | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/openstack/python-horizon/centos/files/0001-Remove-the-hard-coded-internal-URL-for-keystone.patch b/openstack/python-horizon/centos/files/0001-Remove-the-hard-coded-internal-URL-for-keystone.patch index 5b2c18f5..6a7ad797 100644 --- a/openstack/python-horizon/centos/files/0001-Remove-the-hard-coded-internal-URL-for-keystone.patch +++ b/openstack/python-horizon/centos/files/0001-Remove-the-hard-coded-internal-URL-for-keystone.patch @@ -1,12 +1,24 @@ -index 65706bf..4ddc256 100644 +From 0887c59ddffa53a8816e7a30f85fa49bdfce1881 Mon Sep 17 00:00:00 2001 +From: Andy Ning +Date: Thu, 30 Apr 2020 11:45:55 -0400 +Subject: [PATCH] Remove-the-hard-coded-internal-URL-for-keystone + +Signed-off-by: Andy Ning +--- + openstack_dashboard/api/keystone.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py +index af3d779..e4a9ef7 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py -@@ -93,7 +93,7 @@ class Service(base.APIDictWrapper): +@@ -79,7 +79,8 @@ class Service(base.APIDictWrapper): super(Service, self).__init__(service, *args, **kwargs) self.public_url = base.get_url_for_service(service, region, 'publicURL') - self.url = base.get_url_for_service(service, region, 'internalURL') -+ self.url = base.get_url_for_service(service, region) ++ ep_type = getattr(settings, 'OPENSTACK_ENDPOINT_TYPE', 'internalURL') ++ self.url = base.get_url_for_service(service, region, ep_type) if self.url: self.host = urlparse.urlparse(self.url).hostname else: