From 4f5b983a2aeee741729a9489f62aca68f0a4c223 Mon Sep 17 00:00:00 2001 From: "zhu.boxiang" Date: Sun, 26 Jun 2022 22:52:38 +0800 Subject: [PATCH] fix: Check both service and endpoint When we decide whether the endpoint will add into profile, we will both check whether the service has been set for openstack config and the endpoint of this service exists. Closes-Bug: #1979903 Change-Id: I0ad5558a0b6886d9af44c3e88eb43fc43f3cf58a --- skyline_apiserver/client/openstack/system.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/skyline_apiserver/client/openstack/system.py b/skyline_apiserver/client/openstack/system.py index 7d7a915..3bd218f 100644 --- a/skyline_apiserver/client/openstack/system.py +++ b/skyline_apiserver/client/openstack/system.py @@ -56,7 +56,11 @@ async def get_endpoints(region: str) -> Dict[str, Any]: endpoints = {} for service_type, endpoint in catalogs.items(): service = CONF.openstack.service_mapping.get(service_type) - if service is None: + # Two cases: + # 1. The service is created, but no endpoints are created for it. + # 2. The service is not created. + # Both of them, we will not add the related endpoint into profile. + if service is None or not endpoint: continue path = PurePath("/").joinpath(CONF.openstack.nginx_prefix, region.lower(), service)