diff --git a/changelogs/fragments/fix-316.yml b/changelogs/fragments/fix-316.yml new file mode 100644 index 00000000..4569d445 --- /dev/null +++ b/changelogs/fragments/fix-316.yml @@ -0,0 +1,2 @@ +bugfixes: + - Fix error with datasources configured without basicAuth \ No newline at end of file diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index b0496a97..5f865ec5 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -519,7 +519,8 @@ def compare_datasources(new, current, compareSecureData=True): if 'readOnly' in current: del current['readOnly'] if current['basicAuth'] is False: - del current['basicAuthUser'] + if 'basicAuthUser' in current: + del current['basicAuthUser'] if 'password' in current: del current['password'] if 'basicAuthPassword' in current: