diff options
Diffstat (limited to 'integrations/gen_integrations.py')
-rwxr-xr-x | integrations/gen_integrations.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/integrations/gen_integrations.py b/integrations/gen_integrations.py index 19d71d8cc..6d439a52d 100755 --- a/integrations/gen_integrations.py +++ b/integrations/gen_integrations.py @@ -140,9 +140,19 @@ def get_jinja_env(): lstrip_blocks=True, ) + _jinja_env.globals.update(strfy=strfy) + return _jinja_env +def strfy(value): + if not isinstance(value, str): + return value + + return ' '.join([v.strip() for v in value.strip().split("\n") if v]).replace('|', '/') + + + def get_category_sets(categories): default = set() valid = set() @@ -462,7 +472,7 @@ def render_collectors(categories, collectors, ids): item['meta']['monitored_instance']['categories'] = list(default_cats) warn(f'{ item["id"] } does not list any caregories, adding it to: { default_cats }', item["_src_path"]) else: - item['meta']['monitored_instance']['categories'] = list(actual_cats) + item['meta']['monitored_instance']['categories'] = [x for x in item['meta']['monitored_instance']['categories'] if x in list(actual_cats)] for scope in item['metrics']['scopes']: if scope['name'] == 'global': |