community.grafana icon indicating copy to clipboard operation
community.grafana copied to clipboard

Allow parameter uid for datasources

Open CWollinger opened this issue 2 years ago • 2 comments

SUMMARY

With Grafana 8 it is possible to configure the UID of a datasource via the API. In the dashboard json the UID of the datasource is stored (not longer the name). To ensure the provision of datasource's in different environments it is necessary to configure the also the UID. Otherwise the UID is generated automatically and is different to each other.

Fix #223

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

grafana_datasource.py

ADDITIONAL INFORMATION

This can maybe break the idempotency. For example if you use uid parameter below Grafana version 8

CWollinger avatar Apr 01 '22 18:04 CWollinger

Codecov Report

Merging #230 (1714bad) into main (2363eb1) will increase coverage by 0.07%. The diff coverage is 100.00%.

:exclamation: Current head 1714bad differs from pull request most recent head 8a3d6fb. Consider uploading reports for the commit 8a3d6fb to get more accurate results

@@            Coverage Diff             @@
##             main     #230      +/-   ##
==========================================
+ Coverage   73.90%   73.98%   +0.07%     
==========================================
  Files          13       13              
  Lines        1594     1595       +1     
  Branches      274      274              
==========================================
+ Hits         1178     1180       +2     
  Misses        280      280              
+ Partials      136      135       -1     
Flag Coverage Δ
integration 68.61% <100.00%> (+0.12%) :arrow_up:
units 65.76% <0.00%> (-0.07%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...fana/grafana_datasource/test_grafana_datasource.py 90.56% <ø> (ø)
plugins/modules/grafana_datasource.py 76.59% <100.00%> (+0.65%) :arrow_up:
plugins/modules/grafana_plugin.py 25.47% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Apr 01 '22 18:04 codecov[bot]

Update to the module to set the uid. Created integration tests just for the uid

CWollinger avatar Oct 15 '22 23:10 CWollinger

@rrey can we merge this?

CWollinger avatar Nov 10 '22 19:11 CWollinger

@CWollinger yes we can, can you rebase ?

rrey avatar Nov 12 '22 14:11 rrey

Hi @rrey, is it possible to create a new release with this fix?

CWollinger avatar Feb 07 '23 14:02 CWollinger

Just released https://github.com/ansible-collections/community.grafana/releases/tag/1.5.4 Ansible Galaxy should get that soon.

rrey avatar Feb 07 '23 17:02 rrey