From c0a5880d329202990089fec91667dd2fd28cadb6 Mon Sep 17 00:00:00 2001 From: Xavier G Date: Sun, 22 Oct 2017 16:36:10 +0200 Subject: [PATCH] grafana4: datasource: handle missing keys in datasource description. --- salt/states/grafana4_datasource.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/salt/states/grafana4_datasource.py b/salt/states/grafana4_datasource.py index 7ae3ef3e95..d4b698daf9 100644 --- a/salt/states/grafana4_datasource.py +++ b/salt/states/grafana4_datasource.py @@ -151,6 +151,12 @@ def present(name, ret['changes'] = data return ret + # At this stage, the datasource exists; however, the object provided by + # Grafana may lack some null keys compared to our "data" dict: + for key in data: + if key not in datasource: + datasource[key] = None + if data == datasource: ret['changes'] = None ret['comment'] = 'Data source {0} already up-to-date'.format(name)