Fix issues

This commit is contained in:
2025-04-25 10:27:12 +00:00
parent 4bd357c9f4
commit a432d6f39f
22 changed files with 61 additions and 17 deletions

View File

@ -416,4 +416,27 @@ class Services(object):
if repositories["service_type"] == service["service_type"]:
res[i]["repositories"] = repositories["repositories"]
break
return res
def all_services_with_categories(self, cloud_environment, environment):
"""Retrieve all services sorted by categories
"""
res = self.service_categories
for i, category in enumerate(res):
res[i]["services"] = []
for srv in self.all_services:
if environment and cloud_environment:
cloud_environment_check = False
if srv["is_global"] is not True:
for srv_cloud_environment in srv["cloud_environments"]:
if srv_cloud_environment["name"] == cloud_environment:
if srv_cloud_environment["visibility"] == environment:
cloud_environment_check = True
else:
continue
if cloud_environment_check is False:
continue
for i, category in enumerate(res):
if category["name"] == srv["service_category"]:
res[i]["services"].append(srv)
return res