From 636201e440f7403e04d8da5ce7658f8c81b88070 Mon Sep 17 00:00:00 2001 From: Felipe Zipitria Date: Thu, 5 Mar 2020 17:42:57 -0300 Subject: [PATCH] Change to items for py3 compat Signed-off-by: Felipe Zipitria --- _states/grafana3_dashboard.py | 2 +- grafana/client/init.sls | 14 +++++++------- grafana/meta/salt.yml | 2 +- grafana/server.sls | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/_states/grafana3_dashboard.py b/_states/grafana3_dashboard.py index edd5359..e33cd11 100644 --- a/_states/grafana3_dashboard.py +++ b/_states/grafana3_dashboard.py @@ -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 diff --git a/grafana/client/init.sls b/grafana/client/init.sls index 60482b9..f4a2256 100644 --- a/grafana/client/init.sls +++ b/grafana/client/init.sls @@ -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 }}: diff --git a/grafana/meta/salt.yml b/grafana/meta/salt.yml index 50c001f..9a3026b 100644 --- a/grafana/meta/salt.yml +++ b/grafana/meta/salt.yml @@ -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' %} diff --git a/grafana/server.sls b/grafana/server.sls index d60a7b9..72cac74 100644 --- a/grafana/server.sls +++ b/grafana/server.sls @@ -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: