Update integrations/gen_docs_integrations.py (#15997)
Fotis Voutsas committed
Sep 19, 2023 at 11:03 UTC
faa8f0f8d8371576b3532718cd51bbe7a44e9ed2
1 file changed
+8
-8
integrations/gen_docs_integrations.py
+8
-8
@@ -111,11 +111,11 @@ endmeta-->
111
if not os.path.exists(f'{path}/integrations'):
112
os.mkdir(f'{path}/integrations')
113
114
- with open(f'{path}/integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-")}.md', 'w+') as txt:
114
+ with open(f'{path}/integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-").replace("(", "").replace(")", "")}.md', 'w+') as txt:
115
# add custom_edit_url as the md file, so we can have uniqueness in the ingest script
116
# afterwards the ingest will replace this metadata with meta_yaml
117
md = md.replace(
118
- "<!--startmeta", f'<!--startmeta\ncustom_edit_url: \"{meta_yaml.replace("/metadata.yaml", "")}/integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-")}.md\"')
118
+ "<!--startmeta", f'<!--startmeta\ncustom_edit_url: \"{meta_yaml.replace("/metadata.yaml", "")}/integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-").replace("(", "").replace(")", "")}.md\"')
119
120
clean_and_write(md, txt)
121
except Exception as e:
@@ -124,7 +124,7 @@ endmeta-->
124
# If we only created one file inside a collector, add the entry to the symlink_dict, so we can make the link
125
if len(os.listdir(f'{path}/integrations')) == 1:
126
symlink_dict.update(
127
- {path: f'integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-")}.md'})
127
+ {path: f'integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-").replace("(", "").replace(")", "")}.md'})
128
else:
129
try:
130
symlink_dict.pop(path)
@@ -175,11 +175,11 @@ endmeta-->
175
if not os.path.exists(f'{path}/integrations'):
176
os.mkdir(f'{path}/integrations')
177
178
- with open(f'{path}/integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-")}.md', 'w+') as txt:
178
+ with open(f'{path}/integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-").replace("(", "").replace(")", "")}.md', 'w+') as txt:
179
# add custom_edit_url as the md file, so we can have uniqueness in the ingest script
180
# afterwards the ingest will replace this metadata with meta_yaml
181
md = md.replace(
182
- "<!--startmeta", f'<!--startmeta\ncustom_edit_url: \"{meta_yaml.replace("/metadata.yaml", "")}/integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-")}.md\"')
182
+ "<!--startmeta", f'<!--startmeta\ncustom_edit_url: \"{meta_yaml.replace("/metadata.yaml", "")}/integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-").replace("(", "").replace(")", "")}.md\"')
183
184
clean_and_write(md, txt)
185
except Exception as e:
@@ -188,7 +188,7 @@ endmeta-->
188
# If we only created one file inside a collector, add the entry to the symlink_dict, so we can make the link
189
if len(os.listdir(f'{path}/integrations')) == 1:
190
symlink_dict.update(
191
- {path: f'integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-")}.md'})
191
+ {path: f'integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-").replace("(", "").replace(")", "")}.md'})
192
else:
193
try:
194
symlink_dict.pop(path)
@@ -235,12 +235,12 @@ endmeta-->
235
236
if "cloud-notifications" in path:
237
# for cloud notifications we generate them near their metadata.yaml
238
- name = integration['meta']['name'].lower().replace(" ", "_")
238
+ name = integration['meta']['name'].lower().replace(" ", "_").replace("(", "").replace(")", "")
239
if not os.path.exists(f'{path}/integrations'):
240
os.mkdir(f'{path}/integrations')
241
242
proper_edit_name = meta_yaml.replace(
243
- "metadata.yaml", f'integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-")}.md\"')
243
+ "metadata.yaml", f'integrations/{sidebar_label.lower().replace(" ", "_").replace("/", "-").replace("(", "").replace(")", "")}.md\"')
244
245
md = md.replace("<!--startmeta", f'<!--startmeta\ncustom_edit_url: \"{proper_edit_name}')
246