Docs constraints new architecture
Reviewed-by: Tino Schreiber <tino.schreiber@t-systems.com> Co-authored-by: Sebastian Gode <sebastian.gode@telekom.de> Co-committed-by: Sebastian Gode <sebastian.gode@telekom.de>
This commit is contained in:
parent
a41f77df9a
commit
7d4aacf61d
@ -5,9 +5,9 @@ repositories:
|
|||||||
repo: opentelekomcloud-docs/glossary
|
repo: opentelekomcloud-docs/glossary
|
||||||
type: github
|
type: github
|
||||||
cloud_environments:
|
cloud_environments:
|
||||||
-
|
- eu_de
|
||||||
- environment: internal
|
- environment: internal
|
||||||
repo: docs/glossary
|
repo: docs/glossary
|
||||||
type: gitea
|
type: gitea
|
||||||
cloud_environments:
|
cloud_environments:
|
||||||
-
|
- eu_de
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import warnings
|
import warnings
|
||||||
import json
|
|
||||||
|
|
||||||
import otc_metadata.data
|
import otc_metadata.data
|
||||||
|
|
||||||
@ -76,7 +75,7 @@ class Services(object):
|
|||||||
def all_docs(self):
|
def all_docs(self):
|
||||||
"Service Docs data listing."
|
"Service Docs data listing."
|
||||||
return copy.deepcopy(self._service_data["documents"])
|
return copy.deepcopy(self._service_data["documents"])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def all_repositories(self):
|
def all_repositories(self):
|
||||||
"Service Repositories data listing."
|
"Service Repositories data listing."
|
||||||
@ -283,7 +282,7 @@ class Services(object):
|
|||||||
if not service:
|
if not service:
|
||||||
warnings.warn("No Service defition of type %s" % (cat))
|
warnings.warn("No Service defition of type %s" % (cat))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for repositories in self.all_repositories:
|
for repositories in self.all_repositories:
|
||||||
if repositories["service_type"] == service["service_type"]:
|
if repositories["service_type"] == service["service_type"]:
|
||||||
res_doc = copy.deepcopy(doc)
|
res_doc = copy.deepcopy(doc)
|
||||||
@ -386,7 +385,7 @@ class Services(object):
|
|||||||
break
|
break
|
||||||
break
|
break
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_service_with_repo_by_service_type(self, service_type):
|
def get_service_with_repo_by_service_type(self, service_type):
|
||||||
"""Retrieve service with repos by service_type
|
"""Retrieve service with repos by service_type
|
||||||
|
|
||||||
@ -417,7 +416,7 @@ class Services(object):
|
|||||||
res[i]["repositories"] = repositories["repositories"]
|
res[i]["repositories"] = repositories["repositories"]
|
||||||
break
|
break
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def all_services_by_categories(self, cloud_environment, environments):
|
def all_services_by_categories(self, cloud_environment, environments):
|
||||||
"""Retrieve all services sorted by categories
|
"""Retrieve all services sorted by categories
|
||||||
"""
|
"""
|
||||||
@ -440,7 +439,7 @@ class Services(object):
|
|||||||
for i, category in enumerate(res):
|
for i, category in enumerate(res):
|
||||||
if category["name"] == srv["service_category"]:
|
if category["name"] == srv["service_category"]:
|
||||||
res[i]["services"].append(srv)
|
res[i]["services"].append(srv)
|
||||||
|
|
||||||
# Sort services
|
# Sort services
|
||||||
for category in res:
|
for category in res:
|
||||||
category["services"].sort(key=lambda x: x.get("service_title", "").lower())
|
category["services"].sort(key=lambda x: x.get("service_title", "").lower())
|
||||||
@ -448,4 +447,4 @@ class Services(object):
|
|||||||
# Sort categories
|
# Sort categories
|
||||||
res.sort(key=lambda x: x.get("name", "").lower())
|
res.sort(key=lambda x: x.get("name", "").lower())
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
@ -28,7 +28,7 @@ commands = {posargs}
|
|||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
deps =
|
deps =
|
||||||
-r{toxinidir}/doc/requirements.txt
|
-r{toxinidir}/doc/requirements.txt
|
||||||
-c https://raw.githubusercontent.com/opentelekomcloud-docs/docs-constraints/main/constraints.txt
|
-c https://raw.githubusercontent.com/opentelekomcloud-docs/docs-constraints/main/constraints/{{otcdocs_cloud_environment}}/{{target_environment}}/constraints.txt
|
||||||
allowlist_externals =
|
allowlist_externals =
|
||||||
mkdir
|
mkdir
|
||||||
cp
|
cp
|
||||||
|
@ -170,7 +170,7 @@ def process_repositories(args, service):
|
|||||||
if target_repo.get("type") != "github":
|
if target_repo.get("type") != "github":
|
||||||
context["git_type"] = target_repo["type"]
|
context["git_type"] = target_repo["type"]
|
||||||
if (args.target_environment == "public"
|
if (args.target_environment == "public"
|
||||||
and args.cloud_environment == "swiss"):
|
and args.cloud_environment == "swiss"):
|
||||||
context["html_options"] = dict(
|
context["html_options"] = dict(
|
||||||
logo_url="https://docs.sc.otc.t-systems.com",
|
logo_url="https://docs.sc.otc.t-systems.com",
|
||||||
)
|
)
|
||||||
@ -183,7 +183,7 @@ def process_repositories(args, service):
|
|||||||
context["otcdocs_search_environment"] = "hc_de"
|
context["otcdocs_search_environment"] = "hc_de"
|
||||||
context["otcdocs_search_index"] = "search_index_de"
|
context["otcdocs_search_index"] = "search_index_de"
|
||||||
elif (args.target_environment == "internal"
|
elif (args.target_environment == "internal"
|
||||||
and args.cloud_environment == "swiss"):
|
and args.cloud_environment == "swiss"):
|
||||||
context["html_options"] = dict(
|
context["html_options"] = dict(
|
||||||
disable_search=True,
|
disable_search=True,
|
||||||
site_name="Internal Documentation Portal",
|
site_name="Internal Documentation Portal",
|
||||||
|
@ -24,7 +24,7 @@ def main():
|
|||||||
data = otc_metadata.services.Services()
|
data = otc_metadata.services.Services()
|
||||||
data._sort_data()
|
data._sort_data()
|
||||||
|
|
||||||
docs = data.docs_html_by_category(environment="internal",cloud_environment=args.cloud_environment)
|
docs = data.docs_html_by_category(environment="internal", cloud_environment=args.cloud_environment)
|
||||||
|
|
||||||
# Filter out documents with "disable_import": True
|
# Filter out documents with "disable_import": True
|
||||||
for category, services in docs['categories'].items():
|
for category, services in docs['categories'].items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user