next updates

This commit is contained in:
2022-08-23 09:29:16 +02:00
parent 2ff9eeca27
commit 5f3eaf843e
3 changed files with 109 additions and 7 deletions

View File

@ -75,7 +75,7 @@ class Services(object):
res.append(copy.deepcopy(srv))
return res
def docs_by_service_category(self, category, env=None):
def docs_by_service_category(self, category, environment=None):
"""List services matching category
:param str category: Category name
@ -91,11 +91,31 @@ class Services(object):
res_doc.update(**service)
if env:
for srv_env in service["repositories"]:
if srv_env.get("env") == env:
if srv_env.get("environment") == environment:
res_doc["repository"] = srv_env["repo"]
res.append(res_doc)
return res
def all_docs_full(self, environment):
"""Return list or documents with full service data
"""
services = self.service_dict
for doc in self.all_docs:
if not doc["service_type"] in services:
print(f"No service type {doc['service_type']}")
continue
service = services[doc["service_type"]]
res_doc = copy.deepcopy(doc)
res_doc.update(**service)
if environment:
for srv_env in service["repositories"]:
if srv_env.get("environment") == environment:
res_doc["repository"] = srv_env["repo"]
for srv_assignees in service.get("assignees", []):
if srv_assignees.get("environment") == environment:
res_doc["assignees"] = srv_assignees["names"]
yield res_doc
def docs_html_by_category(self, environment):
"""Generate structure for doc-exports repository