Browse Source

Fixes

Change-Id: I2992d1543bd09542239eefd9fd23434f1f374df2
pull/27/head
Swann Croiset 5 years ago
parent
commit
4931237ebc
  1. 3
      grafana/collector.sls
  2. 24
      grafana/meta/salt.yml

3
grafana/collector.sls

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
{%- from "grafana/map.jinja" import collector with context %}
{%- if collector.get('enabled', False) %}
{%- if pillar.get('grafana', {}).get('collector', {}).get('enabled', False) %}
# This state is only used to map grains.collector pillar. Grains are now
# managed from salt.minion.grains so we will just include it in case it's

24
grafana/meta/salt.yml

@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
{%- if pillar.grafana.collector is defined %}
{%- if pillar.grafana.collector.get('enabled', False) %}
{%- set service_grains = {} %}
{%- for service_name, service in pillar.iteritems() %}
{%- if service.get('_support', {}).get('grafana', {}).get('enabled', False) %}
{%- macro load_grains_file(grains_fragment_file) %}{% include grains_fragment_file ignore missing %}{% endmacro %}
{%- set grains_fragment_file = service_name+'/meta/grafana.yml' %}
{%- set grains_yaml = load_grains_file(grains_fragment_file)|load_yaml %}
{%- set service_grains = salt['grains.filter_by']({'default': service_grains}, merge=grains_yaml) %}
{%- endif %}
{%- endfor %}
grain:
{%- if pillar.grafana.collector is defined %}
{%- if collector.get('enabled', False) %}
{%- set service_grains = {} %}
{%- for service_name, service in pillar.iteritems() %}
{%- if service.get('_support', {}).get('grafana', {}).get('enabled', False) %}
{%- macro load_grains_file(grains_fragment_file) %}{% include grains_fragment_file ignore missing %}{% endmacro %}
{%- set grains_fragment_file = service_name+'/meta/grafana.yml' %}
{%- set grains_yaml = load_grains_file(grains_fragment_file)|load_yaml %}
{%- set service_grains = salt['grains.filter_by']({'default': service_grains}, merge=grains_yaml) %}
{%- endif %}
{%- endfor %}
grafana:
{{ service_grains|yaml(False)|indent(4) }}
{%- endif %}
{%- endif %}
{%- endif %}

Loading…
Cancel
Save