Skip to content

Commit

Permalink
chg: only remove basicAuthUser from datasource if it is present
Browse files Browse the repository at this point in the history
If there is no check for its presence, this will fail if a datasource is not configured with basic auth at all.
In that case it would try to remove an entry from the dict that is not there resulting in a KeyError.
  • Loading branch information
Alexander Kasper authored and rrey committed Nov 5, 2023
1 parent 7ab900f commit 297b585
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/modules/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 297b585

Please sign in to comment.