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 }} org_name: ${{ secrets.ANSIBLE_TEST_ORG_NAME }}
grafana_cloud_api_key: ${{ secrets.ANSIBLE_TEST_CLOUD_API_KEY }} grafana_cloud_api_key: ${{ secrets.ANSIBLE_TEST_CLOUD_API_KEY }}
grafana_api_key: ${{ secrets.ANSIBLE_TEST_GRAFANA_API_KEY }} grafana_api_key: ${{ secrets.ANSIBLE_TEST_GRAFANA_API_KEY }}
test_stack_name: ${{ secrets.ANSIBLE_TEST_CI_STACK }}
EOF EOF
- name: Set up Python - name: Set up Python

View File

@ -5,6 +5,19 @@ Grafana.Grafana Release Notes
.. contents:: Topics .. 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 v1.1.0
====== ======

View File

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

View File

@ -75,3 +75,9 @@ releases:
- Added Role for Grafana Agent - Added Role for Grafana Agent
release_summary: Added Role to deploy Grafana Agent on linux hosts release_summary: Added Role to deploy Grafana Agent on linux hosts
release_date: '2022-11-22' 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 namespace: grafana
name: grafana name: grafana
version: 1.1.0 version: 1.1.1
readme: README.md readme: README.md
authors: authors:
- Grafana Labs <grafana.com> - Grafana Labs <grafana.com>
@ -11,4 +11,4 @@ license:
tags: [grafana, observability, monitoring] tags: [grafana, observability, monitoring]
repository: https://github.com/grafana/grafana-ansible-collection repository: https://github.com/grafana/grafana-ansible-collection
issues: https://github.com/grafana/grafana-ansible-collection/issues 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 sample: true
id: id:
description: The ID for the folder. description: The ID for the folder.
returned: on success returned: state is present and on success
type: int type: int
sample: 18 sample: 18
title: title:
@ -151,7 +151,7 @@ output:
description: The message returned after the operation on the folder. description: The message returned after the operation on the folder.
returned: state is absent and on success returned: state is absent and on success
type: str type: str
sample: "Folder foldername deleted" sample: "Folder has been succesfuly deleted"
''' '''
from ansible.module_utils.basic import AnsibleModule, missing_required_lib 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']}) result = requests.delete(api_url, headers={"Authorization": 'Bearer ' + module.params['grafana_api_key']})
if result.status_code == 200: if result.status_code == 200:
return False, True, result.json() return False, True, {"status": result.status_code, 'response': "Folder has been succesfuly deleted"}
else: 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(): def main():

View File

@ -1,7 +1,7 @@
- name: Create a Grafana Cloud stack - name: Create a Grafana Cloud stack
grafana.grafana.cloud_stack: grafana.grafana.cloud_stack:
name: ansiblecollectionstack name: "{{ test_stack_name }}"
stack_slug: ansiblecollectionstack stack_slug: "{{ test_stack_name }}"
cloud_api_key: "{{ grafana_cloud_api_key }}" cloud_api_key: "{{ grafana_cloud_api_key }}"
org_slug: "{{ org_name }}" org_slug: "{{ org_name }}"
state: present state: present
@ -9,7 +9,7 @@
- assert: - assert:
that: that:
- create_result.url == "https://ansiblecollectionstack.grafana.net" - create_result.url == "https://" + "{{ test_stack_name }}" + ".grafana.net"
- name: Sleep for 30 seconds - name: Sleep for 30 seconds
ansible.builtin.wait_for: ansible.builtin.wait_for:
@ -17,8 +17,8 @@
- name: Delete a Grafana Cloud stack - name: Delete a Grafana Cloud stack
grafana.grafana.cloud_stack: grafana.grafana.cloud_stack:
name: ansiblecollectionstack name: "{{ test_stack_name }}"
stack_slug: ansiblecollectionstack stack_slug: "{{ test_stack_name }}"
cloud_api_key: "{{ grafana_cloud_api_key }}" cloud_api_key: "{{ grafana_cloud_api_key }}"
org_slug: "{{ org_name }}" org_slug: "{{ org_name }}"
state: absent state: absent
@ -27,4 +27,4 @@
- assert: - assert:
that: that:
- delete_result.changed == true - 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: - assert:
that: that:
- delete_result.changed == true - delete_result.output.status == 200
- delete_result.output.message == "Folder Ansible Integration test deleted" - delete_result.output.response == "Folder has been succesfuly deleted"