From dafe39dfb6ca3c3b9970d7a2ec1a2245d61f52b1 Mon Sep 17 00:00:00 2001 From: Doug Szumski Date: Wed, 24 Jan 2018 14:59:35 +0000 Subject: [PATCH] Fix retry mechanism If the wrong status code is returned, ansible sets failed: true. This means that a retry is never attempted. Use .get('status') to work around the possibility that a status may not be returned in some corner cases. For example: TASK [grafana : Wait for grafana application ready] ***************** fatal: [some_remote_node]: FAILED! => {"failed": true, "msg": "The conditional check 'result.status == 200' failed. The error was: error while evaluating conditional (result.status == 200): 'dict object' has no attribute 'status'"} Change-Id: I14207d1a9e994fa25c1c061025fff5b64a71d690 Closes-Bug: #1742501 --- ansible/roles/grafana/tasks/post_config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/grafana/tasks/post_config.yml b/ansible/roles/grafana/tasks/post_config.yml index 744135270b..f9dbcb2918 100644 --- a/ansible/roles/grafana/tasks/post_config.yml +++ b/ansible/roles/grafana/tasks/post_config.yml @@ -4,7 +4,7 @@ url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ grafana_server_port }}/login" status_code: 200 register: result - until: result | failed or result.status == 200 + until: result.get('status') == 200 retries: 10 delay: 2 run_once: true