Fix Grafana datasource update

Grafana changed the error message wording.
Match on the shortest sane string to play it safe.

Change-Id: Ic175ebdb1da6ef66047309ff07bcbba98fc67008
Closes-Bug: #1881890
(cherry picked from commit 7bd8805004)
This commit is contained in:
Radosław Piliszek 2020-06-15 11:34:30 +02:00 committed by Mark Goddard
parent a14707bbc1
commit 9a0cf74360
3 changed files with 8 additions and 2 deletions

View File

@ -23,7 +23,7 @@
run_once: True
changed_when: response.status == 200
failed_when: response.status not in [200, 409] or
response.status == 409 and ("Data source with same name already exists" not in response.json.message|default(""))
response.status == 409 and ("name already exists" not in response.json.message|default(""))
with_dict: "{{ grafana_data_sources }}"
when: item.value.enabled | bool

View File

@ -89,6 +89,7 @@
run_once: True
changed_when: monasca_grafana_datasource_response.status == 200
failed_when: monasca_grafana_datasource_response.status not in [200, 409] or
monasca_grafana_datasource_response.status == 409 and ("Data source with same name already exists" not in monasca_grafana_datasource_response.json.message|default(""))
(monasca_grafana_datasource_response.status == 409 and
"name already exists" not in monasca_grafana_datasource_response.json.message|default(""))
with_dict: "{{ monasca_grafana_data_sources }}"
when: item.value.enabled | bool

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes Grafana datasource update.
`LP#1881890 <https://launchpad.net/bugs/1881890>`__