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):
|
||||
'''Strip falsey entries.'''
|
||||
ret = {}
|
||||
for k, v in six.iteritems(d):
|
||||
for k, v in six.items(d):
|
||||
if v:
|
||||
ret[k] = v
|
||||
return ret
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{%- if client.get('enabled', False) %}
|
||||
|
||||
{%- set datasources = [] %}
|
||||
{%- for datasource_name, datasource in client.datasource.iteritems() %}
|
||||
{%- for datasource_name, datasource in client.datasource.items() %}
|
||||
|
||||
{%- do datasources.append(datasource.type) %}
|
||||
grafana_client_datasource_{{ datasource_name }}:
|
||||
|
@ -30,7 +30,7 @@ grafana_client_datasource_{{ datasource_name }}:
|
|||
{%- set final_dict = {} %}
|
||||
|
||||
{%- 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 %}
|
||||
{%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=node_grains.grafana.get('dashboard', {})) %}
|
||||
{%- endif %}
|
||||
|
@ -41,15 +41,15 @@ grafana_client_datasource_{{ datasource_name }}:
|
|||
{%- set raw_dict = salt['grains.filter_by']({'default': raw_dict}, merge=client.dashboard) %}
|
||||
{%- endif %}
|
||||
|
||||
{%- for dashboard_name, dashboard in raw_dict.iteritems() %}
|
||||
{%- for dashboard_name, dashboard in raw_dict.items() %}
|
||||
{%- if dashboard.get('format', 'yaml')|lower == 'yaml' %}
|
||||
# Dashboards in JSON format are considered as blob
|
||||
{%- set rows = [] %}
|
||||
{%- for row_name, row in dashboard.get('row', {}).iteritems() %}
|
||||
{%- for row_name, row in dashboard.get('row', {}).items() %}
|
||||
{%- set panels = [] %}
|
||||
{%- for panel_name, panel in row.get('panel', {}).iteritems() %}
|
||||
{%- for panel_name, panel in row.get('panel', {}).items() %}
|
||||
{%- set targets = [] %}
|
||||
{%- for target_name, target in panel.get('target', {}).iteritems() %}
|
||||
{%- for target_name, target in panel.get('target', {}).items() %}
|
||||
{%- do targets.extend([target]) %}
|
||||
{%- endfor %}
|
||||
{%- do panel.update({'targets': targets}) %}
|
||||
|
@ -64,7 +64,7 @@ grafana_client_datasource_{{ datasource_name }}:
|
|||
{%- do final_dict.update({dashboard_name: dashboard}) %}
|
||||
{%- 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.get('enabled', True) %}
|
||||
grafana_client_dashboard_{{ dashboard_name }}:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{%- if pillar.get('grafana', {}).get('collector') %}
|
||||
{%- if pillar.grafana.collector.get('enabled', False) %}
|
||||
{%- 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) %}
|
||||
{%- macro load_grains_file(grains_fragment_file) %}{% include grains_fragment_file ignore missing %}{% endmacro %}
|
||||
{%- set grains_fragment_file = service_name+'/meta/grafana.yml' %}
|
||||
|
|
|
@ -51,7 +51,7 @@ grafana_copy_default_dashboards:
|
|||
|
||||
{%- 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 %}
|
||||
|
||||
|
@ -108,7 +108,7 @@ grafana_service:
|
|||
- file: /etc/grafana/grafana.ini
|
||||
- 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) %}
|
||||
install_{{ plugin_name }}:
|
||||
cmd.run:
|
||||
|
|
Loading…
Reference in a new issue