diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2023-08-02 08:32:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-02 18:02:17 +0530 |
commit | f1a28f5137b4c76d9b5405c2a12f7164895f7efe (patch) | |
tree | 4e85c4b8bed9deb29cbfbc6e65f88a2cb65aaf95 /integrations/gen_integrations.py | |
parent | 256f22ff0955cbdccdc55af3efb3667153bd2c66 (diff) |
Fix handling of troubleshooting section in integrations. (#15700)
* Fix handling of troubleshooting section in integrations.
* Fix plugin_name key path.
Diffstat (limited to 'integrations/gen_integrations.py')
-rwxr-xr-x | integrations/gen_integrations.py | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/integrations/gen_integrations.py b/integrations/gen_integrations.py index 0246561ceb..19d71d8cca 100755 --- a/integrations/gen_integrations.py +++ b/integrations/gen_integrations.py @@ -56,11 +56,13 @@ COLLECTOR_RENDER_KEYS = [ EXPORTER_RENDER_KEYS = [ 'overview', 'setup', + 'troubleshooting', ] NOTIFICATION_RENDER_KEYS = [ 'overview', 'setup', + 'troubleshooting', ] GITHUB_ACTIONS = os.environ.get('GITHUB_ACTIONS', False) @@ -473,12 +475,15 @@ def render_collectors(categories, collectors, ids): } for key in COLLECTOR_RENDER_KEYS: - template = get_jinja_env().get_template(f'{ key }.md') - data = template.render(entry=item, related=related) + if key in item.keys(): + template = get_jinja_env().get_template(f'{ key }.md') + data = template.render(entry=item, related=related) - if 'variables' in item['meta']['monitored_instance']: - template = get_jinja_env().from_string(data) - data = template.render(variables=item['meta']['monitored_instance']['variables']) + if 'variables' in item['meta']['monitored_instance']: + template = get_jinja_env().from_string(data) + data = template.render(variables=item['meta']['monitored_instance']['variables']) + else: + data = '' item[key] = data @@ -540,12 +545,15 @@ def render_exporters(categories, exporters, ids): for item in exporters: for key in EXPORTER_RENDER_KEYS: - template = get_jinja_env().get_template(f'{ key }.md') - data = template.render(entry=item) + if key in item.keys(): + template = get_jinja_env().get_template(f'{ key }.md') + data = template.render(entry=item) - if 'variables' in item['meta']: - template = get_jinja_env().from_string(data) - data = template.render(variables=item['meta']['variables']) + if 'variables' in item['meta']: + template = get_jinja_env().from_string(data) + data = template.render(variables=item['meta']['variables']) + else: + data = '' item[key] = data @@ -569,12 +577,15 @@ def render_notifications(categories, notifications, ids): for item in notifications: for key in NOTIFICATION_RENDER_KEYS: - template = get_jinja_env().get_template(f'{ key }.md') - data = template.render(entry=item) - - if 'variables' in item['meta']: - template = get_jinja_env().from_string(data) - data = template.render(variables=item['meta']['variables']) + if key in item.keys(): + template = get_jinja_env().get_template(f'{ key }.md') + data = template.render(entry=item) + + if 'variables' in item['meta']: + template = get_jinja_env().from_string(data) + data = template.render(variables=item['meta']['variables']) + else: + data = '' item[key] = data |