From f42528acaf5250db47ad7301691a380d2bf63c89 Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Sun, 6 Sep 2015 11:21:44 +0000 Subject: [PATCH] Properly check failed status No need for a new task. Change-Id: I958f87ac9a1434a2f6052e0271f37e5f3109775e Closes-Bug: #1492337 --- ansible/roles/cinder/tasks/bootstrap.yml | 7 +------ ansible/roles/glance/tasks/bootstrap.yml | 6 +----- ansible/roles/heat/tasks/bootstrap.yml | 6 +----- ansible/roles/keystone/tasks/bootstrap.yml | 6 +----- ansible/roles/neutron/tasks/bootstrap.yml | 7 +------ ansible/roles/nova/tasks/bootstrap.yml | 6 +----- ansible/roles/rabbitmq/tasks/bootstrap.yml | 6 ++---- 7 files changed, 8 insertions(+), 36 deletions(-) diff --git a/ansible/roles/cinder/tasks/bootstrap.yml b/ansible/roles/cinder/tasks/bootstrap.yml index 0c6d8954f6..55269a17a1 100644 --- a/ansible/roles/cinder/tasks/bootstrap.yml +++ b/ansible/roles/cinder/tasks/bootstrap.yml @@ -67,18 +67,13 @@ when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed # https://github.com/ansible/ansible-modules-core/pull/1031 - - name: Waiting for bootstrap container to exit command: docker wait bootstrap_cinder when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed + failed_when: bootstrap_result.stdout != "0" register: bootstrap_result run_once: True -- name: Checking for bootstrap failures - fail: msg="Bootstrapping failed" - run_once: True - when: bootstrap_result|changed and bootstrap_result.stdout != "0" - - name: Cleaning up Cinder bootstrap container docker: name: bootstrap_cinder diff --git a/ansible/roles/glance/tasks/bootstrap.yml b/ansible/roles/glance/tasks/bootstrap.yml index e69d1c27d6..3d62f21667 100644 --- a/ansible/roles/glance/tasks/bootstrap.yml +++ b/ansible/roles/glance/tasks/bootstrap.yml @@ -72,13 +72,9 @@ command: docker wait bootstrap_glance register: bootstrap_result run_once: True + failed_when: bootstrap_result.stdout != "0" when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed -- name: Checking for bootstrap failures - fail: msg="Bootstrapping failed" - run_once: True - when: bootstrap_result|changed and bootstrap_result.stdout != "0" - - name: Cleaning up Glance bootstrap container docker: name: bootstrap_glance diff --git a/ansible/roles/heat/tasks/bootstrap.yml b/ansible/roles/heat/tasks/bootstrap.yml index ba79a360c5..ca772ab303 100644 --- a/ansible/roles/heat/tasks/bootstrap.yml +++ b/ansible/roles/heat/tasks/bootstrap.yml @@ -59,13 +59,9 @@ command: docker wait bootstrap_heat register: bootstrap_result run_once: True + failed_when: bootstrap_result.stdout != "0" when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed -- name: Checking for bootstrap failures - fail: msg="Bootstrapping failed" - run_once: True - when: bootstrap_result|changed and bootstrap_result.stdout != "0" - - name: Cleaning up Heat boostrap container docker: name: bootstrap_heat diff --git a/ansible/roles/keystone/tasks/bootstrap.yml b/ansible/roles/keystone/tasks/bootstrap.yml index 5d58bdd502..34e0aba6ee 100644 --- a/ansible/roles/keystone/tasks/bootstrap.yml +++ b/ansible/roles/keystone/tasks/bootstrap.yml @@ -62,13 +62,9 @@ command: docker wait bootstrap_keystone register: bootstrap_result run_once: True + failed_when: bootstrap_result.stdout != "0" when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed -- name: Checking for bootstrap failures - fail: msg="Bootstrapping failed" - run_once: True - when: bootstrap_result|changed and bootstrap_result.stdout != "0" - - name: Cleaning up Keystone bootstrap container docker: name: bootstrap_keystone diff --git a/ansible/roles/neutron/tasks/bootstrap.yml b/ansible/roles/neutron/tasks/bootstrap.yml index c933e24322..846faf0bf3 100644 --- a/ansible/roles/neutron/tasks/bootstrap.yml +++ b/ansible/roles/neutron/tasks/bootstrap.yml @@ -49,18 +49,13 @@ when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed # https://github.com/ansible/ansible-modules-core/pull/1031 - - name: Waiting for bootstrap container to exit command: docker wait bootstrap_neutron register: bootstrap_result run_once: True + failed_when: bootstrap_result.stdout != "0" when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed -- name: Checking for bootstrap failures - fail: msg="Bootstrapping failed" - run_once: True - when: bootstrap_result|changed and bootstrap_result.stdout != "0" - - name: Cleaning up Neutron bootstrap container docker: name: bootstrap_neutron diff --git a/ansible/roles/nova/tasks/bootstrap.yml b/ansible/roles/nova/tasks/bootstrap.yml index 2a95cb0283..a9d1723b66 100644 --- a/ansible/roles/nova/tasks/bootstrap.yml +++ b/ansible/roles/nova/tasks/bootstrap.yml @@ -53,13 +53,9 @@ command: docker wait bootstrap_nova register: bootstrap_result run_once: True + failed_when: bootstrap_result.stdout != "0" when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed -- name: Checking for bootstrap failures - fail: msg="Bootstrapping failed" - run_once: True - when: bootstrap_result|changed and bootstrap_result.stdout != "0" - - name: Cleaning up Nova bootstrap container docker: name: bootstrap_nova diff --git a/ansible/roles/rabbitmq/tasks/bootstrap.yml b/ansible/roles/rabbitmq/tasks/bootstrap.yml index fc0d719403..4f262e0d0e 100644 --- a/ansible/roles/rabbitmq/tasks/bootstrap.yml +++ b/ansible/roles/rabbitmq/tasks/bootstrap.yml @@ -46,15 +46,13 @@ RABBITMQ_CLUSTER_COOKIE: "{{ rabbitmq_cluster_cookie }}" when: exists.rc != 0 +# https://github.com/ansible/ansible-modules-core/pull/1031 - name: Waiting for bootstrap container command: docker wait rabbitmq_bootstrap register: bootstrap_result + failed_when: bootstrap_result.stdout != "0" when: exists.rc != 0 -- name: Checking for bootstrap failures - fail: msg="Bootstrapping failed" - when: bootstrap_result|changed and bootstrap_result.stdout != "0" - - name: Cleaning up bootstrap container docker: image: "{{ rabbitmq_image_full }}"