Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datasource test updates and minor fixes #74

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ Grafana.Grafana Release Notes

.. contents:: Topics

v2.1.33
======

Release Summary
---------------

Update modules for Datasource Tests and minor fixes

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

- Update modules for datasource tests and minor fixes

v2.1.3
======

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Before the [GitHub Release Workflow](https://github.com/grafana/grafana-ansible-
is run, Contributors should push the new version on Ansible Galaxy Manually.

We currently are not planning any deprecations or new major releases. The current landscape includes minor version updates for
module's documentation in `2.1.4`.
module's documentation in `2.1.5`.

To generate changelogs for a new release, Refer [Generating Changelogs](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections_changelogs.html#generating-changelogs)

Expand Down
2 changes: 1 addition & 1 deletion changelogs/.plugin-cache.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
objects:

Check warning on line 1 in changelogs/.plugin-cache.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

1:1 [document-start] missing document start "---"
role: {}
plugins:
become: {}
Expand Down Expand Up @@ -56,4 +56,4 @@
strategy: {}
test: {}
vars: {}
version: 2.1.3
version: 2.1.4
6 changes: 6 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ancestor: null

Check warning on line 1 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

1:1 [document-start] missing document start "---"
releases:
0.0.1:
changes:
Expand All @@ -15,7 +15,7 @@
0.0.4:
changes:
bugfixes:
- Fix an issue with `cloud_stack` idempotency

Check failure on line 18 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

18:7 [indentation] wrong indentation: expected 8 but found 6
release_date: '2022-08-10'
0.0.5:
changes:
Expand All @@ -24,7 +24,7 @@
0.0.6:
changes:
minor_changes:
- Idempotency updates to cloud_api_key and datasource modules

Check failure on line 27 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

27:7 [indentation] wrong indentation: expected 8 but found 6
release_date: '2022-08-10'
0.0.7:
changes:
Expand All @@ -45,7 +45,7 @@
1.0.3:
changes:
minor_changes:
- Add a fail method to modules source code if `requests` library is not present

Check failure on line 48 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

48:7 [indentation] wrong indentation: expected 8 but found 6
- Fixed markup for arg option in Documentation
- Updated Documentation with `notes` to specify if the check_mode feature is
supported by modules
Expand All @@ -54,38 +54,38 @@
1.0.4:
changes:
bugfixes:
- Fixed cases where cloud_stack and alert_contact_point modules do not return

Check failure on line 57 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

57:7 [indentation] wrong indentation: expected 8 but found 6
a tuple when nothing in loop matches
major_changes:
- All modules except dashboard and datasource modules now support idempotency

Check failure on line 60 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

60:7 [indentation] wrong indentation: expected 8 but found 6
minor_changes:
- All modules use `missing_required_lib`` to compose the message for module.fail_json()

Check failure on line 62 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

62:7 [indentation] wrong indentation: expected 8 but found 6
when required library is missing from host
release_summary: Bug fixes and idempotency fixes for modules
release_date: '2022-11-01'
1.0.5:
changes:
minor_changes:
- Added Note to datasource and dashboard module about not supporting Idempotency

Check failure on line 69 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

69:7 [indentation] wrong indentation: expected 8 but found 6
release_summary: Add Note to modules which don't support Idempotency
release_date: '2022-11-10'
1.1.0:
changes:
major_changes:
- Added Role for Grafana Agent

Check failure on line 75 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

75:7 [indentation] wrong indentation: expected 8 but found 6
release_summary: Added Role to deploy Grafana Agent on linux hosts
release_date: '2022-11-22'
1.1.1:
changes:
minor_changes:
- Updated the return message in grafana.grafana.folder module

Check failure on line 81 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

81:7 [indentation] wrong indentation: expected 8 but found 6
release_summary: Updated return description and value for grafana.grafana.folder
module
release_date: '2023-02-08'
2.0.0:
changes:
major_changes:
- Added Lint support

Check failure on line 88 in changelogs/changelog.yaml

View workflow job for this annotation

GitHub Actions / Perform Linting

88:7 [indentation] wrong indentation: expected 8 but found 6
- Configs for server, metrics, logs, traces, and integrations
- Installation of the latest version
- Local installations when internet connection is not allowed
Expand Down Expand Up @@ -132,3 +132,9 @@
- indentation and Lint fixes to modules
release_summary: Update modules to fix failing Sanity Tests
release_date: '2023-06-27'
2.1.4:
changes:
minor_changes:
- Datasource test updates and minor fixes
release_summary: Update Datasource Tests and minor fixes
release_date: '2023-06-27'
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: grafana
name: grafana
version: 2.1.3
version: 2.1.4
readme: README.md
authors:
- Grafana Labs <grafana.com>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grafana-ansible-collection",
"version": "2.1.3",
"version": "2.1.4",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ def absent_datasource(module):
if module.params['grafana_url'][-1] == '/':
module.params['grafana_url'] = module.params['grafana_url'][:-1]

api_url = module.params['grafana_url'] + '/api/datasources/name' + module.params['dataSource']['name']
api_url = module.params['grafana_url'] + '/api/datasources/name/' + module.params['dataSource']['name']

result = requests.delete(api_url, headers={"Authorization": 'Bearer ' + module.params['grafana_api_key']})

if result.status_code == 200:
return False, True, result.json()
return False, True, {"status": result.status_code, 'response': result.json()['message']}
else:
return True, False, {"status": result.status_code, 'response': result.json()['message']}

Expand Down
24 changes: 24 additions & 0 deletions tests/integration/targets/datasource/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,27 @@
that:
- create_result.changed == true
- create_result.output.message == "Datasource added" or create_result.output.message == "Datasource updated"

- name: Delete a Data Source
grafana.grafana.datasource:
dataSource:
name: ansible-integration
type: influxdb
url: https://grafana.github.com/grafana-ansible-collection
user: user
secureJsonData:
password: password
database: db-name
id: 123
uid: ansibletest
access: proxy
grafana_url: "{{ grafana_url }}"
grafana_api_key: "{{ grafana_api_key }}"
state: absent
register: delete_result

- name: Delete Check
ansible.builtin.assert:
that:
- delete_result.changed == true
- delete_result.output.response == "Data source deleted"
Loading