From 9a0cf74360935eca50341e6e983f1ac4fc9a23f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= Date: Mon, 15 Jun 2020 11:34:30 +0200 Subject: [PATCH] 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 7bd8805004a599de25f615cfe177e4963d3e5d2e) --- ansible/roles/grafana/tasks/post_config.yml | 2 +- ansible/roles/monasca/tasks/post_config.yml | 3 ++- releasenotes/notes/bug-1881890-72c76f5fc065588b.yaml | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-1881890-72c76f5fc065588b.yaml diff --git a/ansible/roles/grafana/tasks/post_config.yml b/ansible/roles/grafana/tasks/post_config.yml index 438f38f57a..674332610b 100644 --- a/ansible/roles/grafana/tasks/post_config.yml +++ b/ansible/roles/grafana/tasks/post_config.yml @@ -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 diff --git a/ansible/roles/monasca/tasks/post_config.yml b/ansible/roles/monasca/tasks/post_config.yml index b41f937282..0c71243da3 100644 --- a/ansible/roles/monasca/tasks/post_config.yml +++ b/ansible/roles/monasca/tasks/post_config.yml @@ -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 diff --git a/releasenotes/notes/bug-1881890-72c76f5fc065588b.yaml b/releasenotes/notes/bug-1881890-72c76f5fc065588b.yaml new file mode 100644 index 0000000000..09ea1fd727 --- /dev/null +++ b/releasenotes/notes/bug-1881890-72c76f5fc065588b.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixes Grafana datasource update. + `LP#1881890 `__