update convert script to latest state

This commit is contained in:
Artem Goncharov 2022-08-25 09:43:06 +02:00
parent e630dfcd20
commit 96b61f9d76

View File

@ -8,18 +8,22 @@ new_data = data._service_data
services = data.service_dict services = data.service_dict
for doc in new_data["documents"]: for srv in new_data["services"]:
service = services.get(doc["service_type"]) if len(srv["repositories"]) ==1:
if not service: r1 = srv["repositories"][0]
continue srv["repositories"] = [
service_link = service["repositories"][0]["repo"].split('/')[1] {
if doc["rst_location"].find("api-ref") >= 0: "environment": r1["environment"],
doc["rst_location"] = "api-ref/source" "repo": r1["repo"],
elif doc["rst_location"].find("umn") >= 0: "type": r1["type"]
doc["rst_location"] = "umn/source" },
doc["type"] = "umn" {
elif doc["rst_location"].find("dev") >= 0: "environment": "public",
doc["rst_location"] = "dev_guide/source" "repo": 'opentelekomcloud-' + r1["repo"],
"type": "github"
},
]
_yaml = YAML() _yaml = YAML()
_yaml.indent(mapping=2, sequence=4, offset=2) _yaml.indent(mapping=2, sequence=4, offset=2)