From 8410edc50dd82e6a37630cbcb0e1f7646acf8001 Mon Sep 17 00:00:00 2001
From: Eduardo Gonzalez <dabarren@gmail.com>
Date: Thu, 15 Jun 2017 11:53:25 +0100
Subject: [PATCH] Add openstack logs in deploy gates

Change-Id: I9195ecb2ab3d20714cb533496e914124c5933ad2
---
 tools/deploy_aio.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/deploy_aio.sh b/tools/deploy_aio.sh
index fb3af3bd5c..2936081a63 100755
--- a/tools/deploy_aio.sh
+++ b/tools/deploy_aio.sh
@@ -21,6 +21,10 @@ EOF
 
 pushd "${KOLLA_ANSIBLE_DIR}"
 
+function get_logs {
+    sudo ansible-playbook -i ${RAW_INVENTORY} --become ${KOLLA_ANSIBLE_DIR}/tests/ansible_get_logs.yml > /tmp/logs/ansible/get-logs
+}
+
 # Copy configs
 sudo cp -a etc/kolla /etc/
 # Generate passwords
@@ -28,6 +32,9 @@ export RAW_INVENTORY=/tmp/kolla/raw_inventory
 
 sudo ansible-playbook -i ${RAW_INVENTORY} --become tests/ansible_generate_inventory.yml
 sudo ansible-playbook -i ${RAW_INVENTORY} --become -e action="deploy" -e type=$KOLLA_TYPE -e base=$KOLLA_BASE tests/ansible_generate_config.yml > /tmp/logs/ansible/generate_config
+
+trap get_logs EXIT
+
 sudo ip l a fake_interface type dummy
 
 sudo tools/generate_passwords.py
@@ -36,4 +43,6 @@ sudo tools/kolla-ansible -i ${RAW_INVENTORY} -vvv prechecks > /tmp/logs/ansible/
 sudo tools/kolla-ansible -i ${RAW_INVENTORY} -vvv deploy > /tmp/logs/ansible/deploy
 sudo tools/kolla-ansible -i ${RAW_INVENTORY} -vvv post-deploy > /tmp/logs/ansible/post-deploy
 
+get_logs
+
 popd