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