diff --git a/_states/grafana3_datasource.py b/_states/grafana3_datasource.py index dbb3312..7d440ae 100644 --- a/_states/grafana3_datasource.py +++ b/_states/grafana3_datasource.py @@ -135,7 +135,7 @@ def present(name, timeout=profile.get('grafana_timeout', 3), ) else: - requests.put( + requests.post( '{0}/api/datasources'.format(profile['grafana_url']), data, auth=_get_auth(profile), diff --git a/grafana/client.sls b/grafana/client.sls index 67a7c07..07c842f 100644 --- a/grafana/client.sls +++ b/grafana/client.sls @@ -19,9 +19,14 @@ grafana_client_datasource_{{ datasource_name }}: - access: proxy {%- endif %} {%- if datasource.user is defined %} - - basic_auth: true - - basic_auth_user: {{ datasource.user }} - - basic_auth_password: {{ datasource.password }} + - user: {{ datasource.user }} + - password: {{ datasource.password }} + {%- endif %} + {%- if datasource.get('is_default', false) %} + - is_default: {{ datasource.is_default }} + {%- endif %} + {%- if datasource.database is defined %} + - database: {{ datasource.database }} {%- endif %} {%- endfor %}