Merge pull request #44235 from xavierog/fix-grafana4-datasource-2017.7

grafana4: datasource: handle missing keys in datasource description.
This commit is contained in:
Mike Place 2017-10-24 03:51:09 -06:00 committed by GitHub
commit a97f1c87e0

View File

@ -151,6 +151,12 @@ def present(name,
ret['changes'] = data ret['changes'] = data
return ret 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: if data == datasource:
ret['changes'] = None ret['changes'] = None
ret['comment'] = 'Data source {0} already up-to-date'.format(name) ret['comment'] = 'Data source {0} already up-to-date'.format(name)