Skip to content

Commit

Permalink
fix: support trailing slash in grafana_url
Browse files Browse the repository at this point in the history
Update tests config to use the problematic trailing slash.
  • Loading branch information
rrey committed Sep 14, 2021
1 parent 37643d5 commit 1a93fb4
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 15 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ Grafana Collection Release Notes
.. contents:: Topics


v1.2.3
======

Bugfixes
--------

- Fix issue with trailing '/' in provided grafana_url. The modules now support values with trailing slashes.

v1.2.2
======

Expand Down
8 changes: 8 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@ releases:
- 1.2.2.yml
- 158-grafana_dashboard-lookup-api-key.yml
release_date: '2021-09-08'
1.2.3:
changes:
bugfixes:
- Fix issue with trailing '/' in provided grafana_url. The modules now support
values with trailing slashes.
fragments:
- 1.2.3.yml
release_date: '2021-09-14'
2 changes: 2 additions & 0 deletions changelogs/fragments/1.2.3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- Fix issue with trailing '/' in provided grafana_url. The modules now support values with trailing slashes.
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace: community
name: grafana
version: 1.2.2
version: 1.2.3
readme: README.md
authors:
- Rémi REY (@rrey)
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/grafana_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def __init__(self, module):
else:
self.headers["Authorization"] = basic_auth_header(module.params['url_username'], module.params['url_password'])
# }}}
self.grafana_url = module.params.get("url")
self.grafana_url = base.clean_url(module.params.get("url"))
if module.params.get("skip_version_check") is False:
try:
grafana_version = self.get_version()
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/grafana_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def __init__(self, module):
else:
self.headers["Authorization"] = basic_auth_header(module.params['url_username'], module.params['url_password'])
# }}}
self.grafana_url = module.params.get("url")
self.grafana_url = base.clean_url(module.params.get("url"))
if module.params.get("skip_version_check") is False:
try:
grafana_version = self.get_version()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

grafana_url: "http://grafana:3000"
grafana_url: "http://grafana:3000/"
grafana_username: "admin"
grafana_password: "admin"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

grafana_url: "http://grafana:3000"
grafana_url: "http://grafana:3000/"
grafana_username: "admin"
grafana_password: "admin"

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/grafana_folder/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

grafana_url: "http://grafana:3000"
grafana_url: "http://grafana:3000/"
grafana_username: "admin"
grafana_password: "admin"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

grafana_url: "http://grafana:3000"
grafana_url: "http://grafana:3000/"
grafana_username: "admin"
grafana_password: "admin"

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/grafana_team/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

grafana_url: "http://grafana:3000"
grafana_url: "http://grafana:3000/"
grafana_username: "admin"
grafana_password: "admin"

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/targets/grafana_team/tasks/create_user.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: Create John Doe for tests purpose through uri module
uri:
url: "{{ grafana_url }}/api/admin/users"
url: "{{ grafana_url }}api/admin/users"
method: POST
user: "{{ grafana_username }}"
password: "{{ grafana_password }}"
Expand All @@ -15,7 +15,7 @@

- name: Create Jane Doe for tests purpose through uri module
uri:
url: "{{ grafana_url }}/api/admin/users"
url: "{{ grafana_url }}api/admin/users"
method: POST
user: "{{ grafana_username }}"
password: "{{ grafana_password }}"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/grafana_user/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
grafana_url: "http://grafana:3000"
grafana_url: "http://grafana:3000/"
grafana_username: "admin"
grafana_password: "admin"
8 changes: 4 additions & 4 deletions tests/integration/targets/grafana_user/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

- name: Check user creation with Grafana API
uri:
url: "{{ grafana_url }}/api/users/lookup?loginOrEmail=harley"
url: "{{ grafana_url }}api/users/lookup?loginOrEmail=harley"
user: "{{ grafana_username }}"
password: "{{ grafana_password }}"
force_basic_auth: yes
Expand Down Expand Up @@ -109,7 +109,7 @@

- name: Check user creation with Grafana API
uri:
url: "{{ grafana_url }}/api/users/lookup?loginOrEmail=batman"
url: "{{ grafana_url }}api/users/lookup?loginOrEmail=batman"
user: "{{ grafana_username }}"
password: "{{ grafana_password }}"
force_basic_auth: yes
Expand Down Expand Up @@ -145,7 +145,7 @@

- name: Check user update with Grafana API
uri:
url: "{{ grafana_url }}/api/users/lookup?loginOrEmail=batman"
url: "{{ grafana_url }}api/users/lookup?loginOrEmail=batman"
user: "{{ grafana_username }}"
password: "{{ grafana_password }}"
force_basic_auth: yes
Expand Down Expand Up @@ -188,7 +188,7 @@

- name: Check user deletion with Grafana API (expect 404 Not Found)
uri:
url: "{{ grafana_url }}/api/users/lookup?loginOrEmail=batman"
url: "{{ grafana_url }}api/users/lookup?loginOrEmail=batman"
user: "{{ grafana_username }}"
password: "{{ grafana_password }}"
force_basic_auth: yes
Expand Down

0 comments on commit 1a93fb4

Please sign in to comment.