Fix failing CI for grafana.grafana.folder module (#31)

This commit is contained in:
Ishan Jain 2023-02-08 15:05:28 +05:30 committed by GitHub
parent e50c140071
commit 23d06db751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 16 deletions

View File

@ -67,6 +67,7 @@ jobs:
org_name: ${{ secrets.ANSIBLE_TEST_ORG_NAME }}
grafana_cloud_api_key: ${{ secrets.ANSIBLE_TEST_CLOUD_API_KEY }}
grafana_api_key: ${{ secrets.ANSIBLE_TEST_GRAFANA_API_KEY }}
test_stack_name: ${{ secrets.ANSIBLE_TEST_CI_STACK }}
EOF
- name: Set up Python

View File

@ -5,6 +5,19 @@ Grafana.Grafana Release Notes
.. contents:: Topics
v1.1.1
======
Release Summary
---------------
Updated return description and value for grafana.grafana.folder module
Minor Changes
-------------
- Updated the return message in grafana.grafana.folder module
v1.1.0
======

View File

@ -1,10 +1,12 @@
objects: {}
objects:
role: {}
plugins:
become: {}
cache: {}
callback: {}
cliconf: {}
connection: {}
filter: {}
httpapi: {}
inventory: {}
lookup: {}
@ -52,5 +54,6 @@ plugins:
netconf: {}
shell: {}
strategy: {}
test: {}
vars: {}
version: 1.1.0
version: 1.1.1

View File

@ -75,3 +75,9 @@ releases:
- Added Role for Grafana Agent
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
release_summary: Updated return description and value for grafana.grafana.folder module
release_date: '2023-02-08'

View File

@ -1,6 +1,6 @@
namespace: grafana
name: grafana
version: 1.1.0
version: 1.1.1
readme: README.md
authors:
- Grafana Labs <grafana.com>
@ -11,4 +11,4 @@ license:
tags: [grafana, observability, monitoring]
repository: https://github.com/grafana/grafana-ansible-collection
issues: https://github.com/grafana/grafana-ansible-collection/issues
documentation: https://grafana.github.io/grafana-ansible-collection/
documentation: https://docs.ansible.com/ansible/devel/collections/grafana/grafana/index.html

View File

@ -114,7 +114,7 @@ output:
sample: true
id:
description: The ID for the folder.
returned: on success
returned: state is present and on success
type: int
sample: 18
title:
@ -151,7 +151,7 @@ output:
description: The message returned after the operation on the folder.
returned: state is absent and on success
type: str
sample: "Folder foldername deleted"
sample: "Folder has been succesfuly deleted"
'''
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
@ -213,9 +213,9 @@ def absent_folder(module):
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': "Folder has been succesfuly deleted"}
else:
return True, False, {"status": result.status_code, 'response': result.json()['message']}
return True, False, {"status": result.status_code, 'response': "Error deleting folder"}
def main():

View File

@ -1,7 +1,7 @@
- name: Create a Grafana Cloud stack
grafana.grafana.cloud_stack:
name: ansiblecollectionstack
stack_slug: ansiblecollectionstack
name: "{{ test_stack_name }}"
stack_slug: "{{ test_stack_name }}"
cloud_api_key: "{{ grafana_cloud_api_key }}"
org_slug: "{{ org_name }}"
state: present
@ -9,7 +9,7 @@
- assert:
that:
- create_result.url == "https://ansiblecollectionstack.grafana.net"
- create_result.url == "https://" + "{{ test_stack_name }}" + ".grafana.net"
- name: Sleep for 30 seconds
ansible.builtin.wait_for:
@ -17,8 +17,8 @@
- name: Delete a Grafana Cloud stack
grafana.grafana.cloud_stack:
name: ansiblecollectionstack
stack_slug: ansiblecollectionstack
name: "{{ test_stack_name }}"
stack_slug: "{{ test_stack_name }}"
cloud_api_key: "{{ grafana_cloud_api_key }}"
org_slug: "{{ org_name }}"
state: absent
@ -27,4 +27,4 @@
- assert:
that:
- delete_result.changed == true
- delete_result.url == "https://ansiblecollectionstack.grafana.net"
- delete_result.url == "https://" + "{{ test_stack_name }}" + ".grafana.net"

View File

@ -24,5 +24,5 @@
- assert:
that:
- delete_result.changed == true
- delete_result.output.message == "Folder Ansible Integration test deleted"
- delete_result.output.status == 200
- delete_result.output.response == "Folder has been succesfuly deleted"