Merge "Fix filter in '/keystone/svc-catalog' api"

This commit is contained in:
Zuul
2025-05-16 11:45:57 +00:00
committed by Gerrit Code Review

View File

@@ -13,8 +13,6 @@
# limitations under the License. # limitations under the License.
"""API over the keystone service.""" """API over the keystone service."""
import copy
from django.conf import settings from django.conf import settings
import django.http import django.http
from django.views import generic from django.views import generic
@@ -543,14 +541,18 @@ class ServiceCatalog(generic.View):
@rest_utils.ajax() @rest_utils.ajax()
def get(self, request): def get(self, request):
"""Return the service catalog associated with the current user.""" """Return the service catalog associated with the current user."""
catalog = copy.deepcopy(request.user.service_catalog) new_catalog = []
for record in catalog:
for record in request.user.service_catalog:
new_endpoints = []
for endpoint in record['endpoints']: for endpoint in record['endpoints']:
if endpoint['interface'] != 'public': if endpoint['interface'] == 'public':
record['endpoints'].remove(endpoint) new_endpoints.append(endpoint)
if not record['endpoints']: if new_endpoints:
catalog.remove(record) record['endpoints'] = new_endpoints
return catalog new_catalog.append(record)
return new_catalog
@urls.register @urls.register