fix for python3, items must be used instead of iteritems
This commit is contained in:
parent
4c811e1c02
commit
3877385b8e
3 changed files with 10 additions and 10 deletions
|
@ -2,7 +2,7 @@
|
||||||
{%- if client.get('enabled', False) %}
|
{%- if client.get('enabled', False) %}
|
||||||
|
|
||||||
{%- set datasources = [] %}
|
{%- set datasources = [] %}
|
||||||
{%- for datasource_name, datasource in client.datasource.iteritems() %}
|
{%- for datasource_name, datasource in client.datasource.items() %}
|
||||||
|
|
||||||
{%- do datasources.append(datasource.type) %}
|
{%- do datasources.append(datasource.type) %}
|
||||||
grafana_client_datasource_{{ datasource_name }}:
|
grafana_client_datasource_{{ datasource_name }}:
|
||||||
|
@ -42,7 +42,7 @@ grafana_client_datasource_{{ datasource_name }}:
|
||||||
{%- set parameters = {} %}
|
{%- set parameters = {} %}
|
||||||
|
|
||||||
{%- if client.remote_data.engine == 'salt_mine' %}
|
{%- if client.remote_data.engine == 'salt_mine' %}
|
||||||
{%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').iteritems() %}
|
{%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').items() %}
|
||||||
{%- if node_grains.grafana is defined %}
|
{%- if node_grains.grafana is defined %}
|
||||||
{%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=node_grains.grafana.get('dashboard', {})) %}
|
{%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=node_grains.grafana.get('dashboard', {})) %}
|
||||||
{%- set parameters = salt['grains.filter_by']({'default': parameters}, merge=node_grains.grafana.get('parameters', {})) %}
|
{%- set parameters = salt['grains.filter_by']({'default': parameters}, merge=node_grains.grafana.get('parameters', {})) %}
|
||||||
|
@ -57,15 +57,15 @@ grafana_client_datasource_{{ datasource_name }}:
|
||||||
{%- set parameters = salt['grains.filter_by']({'default': parameters}, merge=client.parameters) %}
|
{%- set parameters = salt['grains.filter_by']({'default': parameters}, merge=client.parameters) %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- for dashboard_name, dashboard in raw_dict.iteritems() %}
|
{%- for dashboard_name, dashboard in raw_dict.items() %}
|
||||||
{%- if dashboard.get('format', 'yaml')|lower == 'yaml' %}
|
{%- if dashboard.get('format', 'yaml')|lower == 'yaml' %}
|
||||||
# Dashboards in JSON format are considered as blob
|
# Dashboards in JSON format are considered as blob
|
||||||
{%- set rows = [] %}
|
{%- set rows = [] %}
|
||||||
{%- for row_name, row in dashboard.get('row', {}).iteritems() %}
|
{%- for row_name, row in dashboard.get('row', {}).items() %}
|
||||||
{%- set panels = [] %}
|
{%- set panels = [] %}
|
||||||
{%- for panel_name, panel in row.get('panel', {}).iteritems() %}
|
{%- for panel_name, panel in row.get('panel', {}).items() %}
|
||||||
{%- set targets = [] %}
|
{%- set targets = [] %}
|
||||||
{%- for target_name, target in panel.get('target', {}).iteritems() %}
|
{%- for target_name, target in panel.get('target', {}).items() %}
|
||||||
{%- do targets.extend([target]) %}
|
{%- do targets.extend([target]) %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- do panel.update({'targets': targets}) %}
|
{%- do panel.update({'targets': targets}) %}
|
||||||
|
@ -80,7 +80,7 @@ grafana_client_datasource_{{ datasource_name }}:
|
||||||
{%- do final_dict.update({dashboard_name: dashboard}) %}
|
{%- do final_dict.update({dashboard_name: dashboard}) %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
{%- for dashboard_name, dashboard in final_dict.iteritems() %}
|
{%- for dashboard_name, dashboard in final_dict.items() %}
|
||||||
{%- if dashboard.datasource is not defined or dashboard.datasource in datasources %}
|
{%- if dashboard.datasource is not defined or dashboard.datasource in datasources %}
|
||||||
{%- if dashboard.get('enabled', True) %}
|
{%- if dashboard.get('enabled', True) %}
|
||||||
grafana_client_dashboard_{{ dashboard_name }}:
|
grafana_client_dashboard_{{ dashboard_name }}:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{%- if pillar.get('grafana', {}).get('collector') %}
|
{%- if pillar.get('grafana', {}).get('collector') %}
|
||||||
{%- if pillar.grafana.collector.get('enabled', False) %}
|
{%- if pillar.grafana.collector.get('enabled', False) %}
|
||||||
{%- set service_grains = {} %}
|
{%- set service_grains = {} %}
|
||||||
{%- for service_name, service in pillar.iteritems() %}
|
{%- for service_name, service in pillar.items() %}
|
||||||
{%- if service.get('_support', {}).get('grafana', {}).get('enabled', False) %}
|
{%- if service.get('_support', {}).get('grafana', {}).get('enabled', False) %}
|
||||||
{%- macro load_grains_file(grains_fragment_file) %}{% include grains_fragment_file ignore missing %}{% endmacro %}
|
{%- 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_fragment_file = service_name+'/meta/grafana.yml' %}
|
||||||
|
|
|
@ -51,7 +51,7 @@ grafana_copy_default_dashboards:
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- for theme_name, theme in server.get('theme', {}).iteritems() %}
|
{%- for theme_name, theme in server.get('theme', {}).items() %}
|
||||||
|
|
||||||
{%- if theme.css_override is defined %}
|
{%- if theme.css_override is defined %}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ grafana_service:
|
||||||
- file: /etc/grafana/grafana.ini
|
- file: /etc/grafana/grafana.ini
|
||||||
- file: /etc/default/grafana-server
|
- file: /etc/default/grafana-server
|
||||||
|
|
||||||
{%- for plugin_name, plugin in server.get('plugins', {}).iteritems() %}
|
{%- for plugin_name, plugin in server.get('plugins', {}).items() %}
|
||||||
{%- if plugin.get('enabled', False) %}
|
{%- if plugin.get('enabled', False) %}
|
||||||
install_{{ plugin_name }}:
|
install_{{ plugin_name }}:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
|
|
Loading…
Reference in a new issue