Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rrey authored Nov 4, 2023
2 parents d80cf1e + 4e0195e commit 0a84199
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 52 deletions.
6 changes: 1 addition & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
.github

# Repo maintainers, and goverance team (like Anisble's @ansible-commit-external)
* @rrey @seuf @gundalow-collections/community-goverance-team
* @rrey @seuf

# or possibly, we may want to define teams at the org level.
# * @gundalow-collections/grafana-maintainers

# Example of maintainer of just a single plugin
#grafana/plugins/modules/grafana_plugin.py @someone-else


.github/ @gundalow
8 changes: 4 additions & 4 deletions .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python_version: ["3.9"]
python_version: ["3.10"]
ansible_version: ["stable-2.13", "stable-2.14", "devel"]
steps:
- name: Perform testing
Expand All @@ -29,7 +29,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python_version: ["3.9"]
python_version: ["3.10"]
ansible_version: ["stable-2.13", "stable-2.14", "devel"]
steps:
- name: Perform testing
Expand All @@ -45,9 +45,9 @@ jobs:
strategy:
fail-fast: false
matrix:
grafana_version: ["9.2.6", "8.5.15", "7.5.16"]
grafana_version: ["9.5.13", "8.5.27", "10.2.0"]
ansible_version: ["stable-2.13", "stable-2.14", "devel"]
python_version: ["3.9"]
python_version: ["3.10"]
services:
grafana:
image: grafana/grafana:${{ matrix.grafana_version }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Click on the name of a plugin or module to view that content's documentation:
We aim at keeping the last 3 Major versions of Grafana tested.
This collection is currently testing the modules against following versions of Grafana:
```
grafana_version: ["9.2.6", "8.5.15", "7.5.16"]
grafana_version: ["9.5.13", "8.5.27", "10.2.0"]
```

## Installation and Usage
Expand Down
5 changes: 5 additions & 0 deletions changelogs/fragments/294-bump-grafana-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
minor_changes:
- Bump version of Python used in tests to 3.10
- Now testing against Grafana 9.5.13, 8.5.27, 10.2.0
bugfixes:
- grafana_folder, fix an issue during delete (starting Grafana 9.3)
2 changes: 1 addition & 1 deletion hacking/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
requests==2.28.0
requests==2.31.0
7 changes: 5 additions & 2 deletions plugins/modules/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,18 @@
(index name), C(mysql) or C(postgres).
required: false
type: str
default: ''
user:
description:
- The datasource login user for influxdb datasources.
type: str
default: ''
password:
description:
- The datasource password.
- Stored as secure data, see C(enforce_secure_data) and notes!
type: str
default: ''
basic_auth_user:
description:
- The datasource basic auth user.
Expand Down Expand Up @@ -180,6 +183,7 @@
- Monthly
- Yearly
type: str
default: ''
tsdb_version:
description:
- The opentsdb version.
Expand Down Expand Up @@ -280,7 +284,6 @@
aws_custom_metrics_namespaces:
description:
- Namespaces of Custom Metrics for CloudWatch datasource type
default: ''
required: false
type: str
azure_cloud:
Expand Down Expand Up @@ -494,7 +497,7 @@

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six.moves.urllib.parse import quote
from ansible.module_utils.urls import fetch_url, url_argument_spec, basic_auth_header
from ansible.module_utils.urls import fetch_url, basic_auth_header
from ansible_collections.community.grafana.plugins.module_utils import base


Expand Down
5 changes: 4 additions & 1 deletion plugins/modules/grafana_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ def _send_request(self, url, data=None, headers=None, method="GET"):
error_msg = resp.read()['message']
self._module.fail_json(failed=True, msg=error_msg)
elif status_code == 200:
return self._module.from_json(resp.read())
# XXX: Grafana folders endpoint stopped sending back json in response for delete operations
# see https://github.com/grafana/grafana/issues/77673
response = resp.read() or "{}"
return self._module.from_json(response)
self._module.fail_json(failed=True, msg="Grafana Folders API answered with HTTP %d" % status_code)

def get_version(self):
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/targets/grafana_dashboard/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- block:
- include: dashboard-from-url.yml
- include: delete-dashboard.yml
- include: dashboard-from-id.yml
- include: dashboard-from-file.yml
- include: dashboard-export.yml
- include: dashboard-folder-destination.yml
- include_tasks: dashboard-from-url.yml
- include_tasks: delete-dashboard.yml
- include_tasks: dashboard-from-id.yml
- include_tasks: dashboard-from-file.yml
- include_tasks: dashboard-export.yml
- include_tasks: dashboard-folder-destination.yml
22 changes: 11 additions & 11 deletions tests/integration/targets/grafana_datasource/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---

- block:
- include: errors.yml
- include: elastic.yml
- include: influx.yml
- include: postgres.yml
- include: cloudwatch.yml
- include: thruk.yml
- include: loki.yml
- include: zabbix.yml
- include: redis.yml
- include: azure.yml
- include: uid.yml
- include_tasks: errors.yml
- include_tasks: elastic.yml
- include_tasks: influx.yml
- include_tasks: postgres.yml
- include_tasks: cloudwatch.yml
- include_tasks: thruk.yml
- include_tasks: loki.yml
- include_tasks: zabbix.yml
- include_tasks: redis.yml
- include_tasks: azure.yml
- include_tasks: uid.yml

...
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
- block:
- include: dingding.yml
- include: discord.yml
- include: email.yml
- include: googlechat.yml
- include: hipchat.yml
- include: kafka.yml
# - include: line.yml
- include: teams.yml
- include: opsgenie.yml
- include: pagerduty.yml
- include: prometheus.yml
- include: pushover.yml
- include: sensu.yml
- include: slack-and-beyond.yml
- include: telegram.yml
# - include: threema.yml
- include: victorops.yml
- include: webhook.yml
- include_tasks: dingding.yml
- include_tasks: discord.yml
- include_tasks: email.yml
- include_tasks: googlechat.yml
- include_tasks: hipchat.yml
- include_tasks: kafka.yml
# - include_tasks: line.yml
- include_tasks: teams.yml
- include_tasks: opsgenie.yml
- include_tasks: pagerduty.yml
- include_tasks: prometheus.yml
- include_tasks: pushover.yml
- include_tasks: sensu.yml
- include_tasks: slack-and-beyond.yml
- include_tasks: telegram.yml
# - include_tasks: threema.yml
- include_tasks: victorops.yml
- include_tasks: webhook.yml
4 changes: 4 additions & 0 deletions tests/sanity/ignore-2.16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins/modules/grafana_dashboard.py validate-modules:invalid-argument-name
tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291
hacking/check_fragment.sh shebang
hacking/find_grafana_versions.py shebang
4 changes: 4 additions & 0 deletions tests/sanity/ignore-2.17.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins/modules/grafana_dashboard.py validate-modules:invalid-argument-name
tests/unit/modules/grafana/grafana_plugin/test_grafana_plugin.py pep8:W291
hacking/check_fragment.sh shebang
hacking/find_grafana_versions.py shebang
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import (absolute_import, division, print_function)

from unittest import TestCase
from unittest.mock import call, patch, MagicMock
from unittest.mock import patch
from ansible_collections.community.grafana.plugins.modules import grafana_datasource
from ansible.module_utils._text import to_bytes
from ansible.module_utils import basic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import (absolute_import, division, print_function)

from unittest import TestCase
from unittest.mock import patch, MagicMock
from unittest.mock import patch
from ansible_collections.community.grafana.plugins.modules import grafana_team
from ansible.module_utils._text import to_bytes
from ansible.module_utils import basic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import (absolute_import, division, print_function)

from unittest import TestCase
from unittest.mock import call, patch, MagicMock
from unittest.mock import call, patch
from ansible_collections.community.grafana.plugins.modules import grafana_user
from ansible.module_utils._text import to_bytes
from ansible.module_utils import basic
Expand Down

0 comments on commit 0a84199

Please sign in to comment.