Merge "fix: Check both service and endpoint"

This commit is contained in:
Zuul 2022-06-26 15:59:16 +00:00 committed by Gerrit Code Review
commit e7b2fb01b0

View File

@ -56,7 +56,11 @@ async def get_endpoints(region: str) -> Dict[str, Any]:
endpoints = {} endpoints = {}
for service_type, endpoint in catalogs.items(): for service_type, endpoint in catalogs.items():
service = CONF.openstack.service_mapping.get(service_type) 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 continue
path = PurePath("/").joinpath(CONF.openstack.nginx_prefix, region.lower(), service) path = PurePath("/").joinpath(CONF.openstack.nginx_prefix, region.lower(), service)