add script for syncing docs
This commit is contained in:
27
tools/convert_data.py
Normal file
27
tools/convert_data.py
Normal file
@ -0,0 +1,27 @@
|
||||
import copy
|
||||
|
||||
import otc_metadata.services
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
data = otc_metadata.services.Services()
|
||||
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"
|
||||
|
||||
_yaml = YAML()
|
||||
_yaml.indent(mapping=2, sequence=4, offset=2)
|
||||
with open('new.yaml', 'w') as fd:
|
||||
_yaml.dump(new_data, fd)
|
@ -11,8 +11,6 @@ api_session = requests.Session()
|
||||
|
||||
|
||||
def open_issue(args, repository, issue_data):
|
||||
#if issue_data['repository'] not in ['docs/elastic-cloud-server']:
|
||||
# return
|
||||
req = dict(
|
||||
title=issue_data["title"],
|
||||
body=issue_data["body"].replace("\\n", "\n")
|
||||
|
192
tools/sync_doc_repo.py
Normal file
192
tools/sync_doc_repo.py
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user