Change to items for py3 compat
Signed-off-by: Felipe Zipitria <fzipitria@perceptyx.com>
This commit is contained in:
parent
69c785aa13
commit
636201e440
4 changed files with 11 additions and 11 deletions
|
@ -579,7 +579,7 @@ def _dashboard_diff(_new_dashboard, _old_dashboard):
|
||||||
def _stripped(d):
|
def _stripped(d):
|
||||||
'''Strip falsey entries.'''
|
'''Strip falsey entries.'''
|
||||||
ret = {}
|
ret = {}
|
||||||
for k, v in six.iteritems(d):
|
for k, v in six.items(d):
|
||||||
if v:
|
if v:
|
||||||
ret[k] = v
|
ret[k] = v
|
||||||
return ret
|
return ret
|
||||||
|
|
|
@ -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 }}:
|
||||||
|
@ -30,7 +30,7 @@ grafana_client_datasource_{{ datasource_name }}:
|
||||||
{%- set final_dict = {} %}
|
{%- set final_dict = {} %}
|
||||||
|
|
||||||
{%- 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', {})) %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -41,15 +41,15 @@ grafana_client_datasource_{{ datasource_name }}:
|
||||||
{%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=client.dashboard) %}
|
{%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=client.dashboard) %}
|
||||||
{%- 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}) %}
|
||||||
|
@ -64,7 +64,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 %}
|
||||||
|
|
||||||
|
@ -108,7 +108,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