Skip to content

Commit

Permalink
Merge branch 'main' into feat/telekom-mms-role
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemental committed Jan 19, 2024
2 parents d52c9f6 + 195f9d1 commit 44cc870
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 6 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ Grafana Collection Release Notes
.. contents:: Topics


v1.7.0
======

Minor Changes
-------------

- Add Quickwit search engine datasource (https://quickwit.io).
- Add parameter `org_name` to `grafana_dashboard`
- Add parameter `org_name` to `grafana_datasource`
- Add parameter `org_name` to `grafana_organization_user`
- Add support for Grafana Tempo datasource type (https://grafana.com/docs/grafana/latest/datasources/tempo/)
- default to true/false in docs and code

Bugfixes
--------

- Add `grafana_organiazion_user` to `action_groups.grafana`
- Fixed orgId handling in diff comparison for `grafana_datasource` if using org_name

v1.6.1
======

Expand Down
29 changes: 29 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,32 @@ releases:
- 300_datasource_prometheus_time_interval.yml
- fix-316.yml
release_date: '2023-11-05'
1.7.0:
changes:
bugfixes:
- Add `grafana_organiazion_user` to `action_groups.grafana`
- Fixed orgId handling in diff comparison for `grafana_datasource` if using
org_name
minor_changes:
- Add Quickwit search engine datasource (https://quickwit.io).
- Add parameter `org_name` to `grafana_dashboard`
- Add parameter `org_name` to `grafana_datasource`
- Add parameter `org_name` to `grafana_organization_user`
- Add support for Grafana Tempo datasource type (https://grafana.com/docs/grafana/latest/datasources/tempo/)
- default to true/false in docs and code
fragments:
- 238_checkmode.yml
- 308_datasource_quickwit.yml
- 318-org_users_by_org_name.yml
- 321-action-groups-org-users.yml
- 324_formatting.yml
- 325_linting.yml
- 325_true_false.yml
- 331-dashboard-by-org-name.yml
- 332-datasource-by-org-name.yml
- 335-add-datasource-type-tempo.yml
- 339-lint-black.yml
- 341-lint-ruff.yml
- 342-ruff-findings.yml
- 345-datasource-compare-diff-orgid.yml
release_date: '2024-01-17'
3 changes: 3 additions & 0 deletions changelogs/fragments/345-datasource-compare-diff-orgid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- Fixed orgId handling in diff comparison for `grafana_datasource` if using org_name
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: community
name: grafana
version: 1.6.1
version: 1.7.0
readme: README.md
authors:
- Rémi REY (@rrey)
Expand Down
11 changes: 6 additions & 5 deletions plugins/modules/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,9 @@ def compare_datasources(new, current, compareSecureData=True):
return dict(before=current, after=new)


def get_datasource_payload(data):
def get_datasource_payload(data, org_id=None):
payload = {
"orgId": data["org_id"],
"orgId": data["org_id"] if org_id is None else org_id,
"name": data["name"],
"uid": data["uid"],
"type": data["ds_type"],
Expand Down Expand Up @@ -688,6 +688,7 @@ class GrafanaInterface(object):
def __init__(self, module):
self._module = module
self.grafana_url = base.clean_url(module.params.get("url"))
self.org_id = None
# {{{ Authentication header
self.headers = {"Content-Type": "application/json"}
if module.params.get("grafana_api_key", None):
Expand All @@ -698,12 +699,12 @@ def __init__(self, module):
self.headers["Authorization"] = basic_auth_header(
module.params["url_username"], module.params["url_password"]
)
org_id = (
self.org_id = (
self.organization_by_name(module.params["org_name"])
if module.params["org_name"]
else module.params["org_id"]
)
self.switch_organization(org_id)
self.switch_organization(self.org_id)
# }}}

def _send_request(self, url, data=None, headers=None, method="GET"):
Expand Down Expand Up @@ -923,7 +924,7 @@ def main():
ds = grafana_iface.datasource_by_name(name)

if state == "present":
payload = get_datasource_payload(module.params)
payload = get_datasource_payload(module.params, grafana_iface.org_id)
if ds is None:
grafana_iface.create_datasource(payload)
ds = grafana_iface.datasource_by_name(name)
Expand Down

0 comments on commit 44cc870

Please sign in to comment.