From 0997b68540ce9ae6c348fe05e5497aac89b52be9 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Thu, 21 Dec 2017 15:12:05 +0000 Subject: xci: nfvi: OSA: Set 'pipefail' when SSHing on the OPNFV host We need to set the 'pipefail' option so if an SSH command fails we stop the deployment instead of silently ignoring it just because the right leg of the pipe succeeded. Change-Id: Iebc720fbd3e6e96fc7135a6cf15e3c0941974d2c Signed-off-by: Markos Chandras --- xci/nfvi/osa/nfvi-deploy.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'xci') diff --git a/xci/nfvi/osa/nfvi-deploy.sh b/xci/nfvi/osa/nfvi-deploy.sh index c074adde..c4419de6 100755 --- a/xci/nfvi/osa/nfvi-deploy.sh +++ b/xci/nfvi/osa/nfvi-deploy.sh @@ -90,7 +90,7 @@ fi #------------------------------------------------------------------------------- echo "Info: Setting up target hosts for openstack-ansible" echo "-----------------------------------------------------------------------" -ssh root@$OPNFV_HOST_IP "openstack-ansible ${XCI_ANSIBLE_VERBOSITY} \ +ssh root@$OPNFV_HOST_IP "set -o pipefail; openstack-ansible ${XCI_ANSIBLE_VERBOSITY} \ releng-xci/.cache/repos/openstack-ansible/playbooks/setup-hosts.yml | tee setup-hosts.log " scp root@$OPNFV_HOST_IP:~/setup-hosts.log $LOG_PATH/setup-hosts.log echo "-----------------------------------------------------------------------" @@ -111,7 +111,7 @@ echo "Info: Set up target hosts for openstack-ansible successfuly" #------------------------------------------------------------------------------- echo "Info: Gathering facts" echo "-----------------------------------------------------------------------" -ssh root@$OPNFV_HOST_IP "cd releng-xci/.cache/repos/openstack-ansible/playbooks; \ +ssh root@$OPNFV_HOST_IP "set -o pipefail; cd releng-xci/.cache/repos/openstack-ansible/playbooks; \ ansible ${XCI_ANSIBLE_VERBOSITY} -m setup -a gather_subset=network,hardware,virtual all" echo "-----------------------------------------------------------------------" @@ -123,7 +123,7 @@ echo "-----------------------------------------------------------------------" echo "Info: Setting up infrastructure" echo "-----------------------------------------------------------------------" echo "xci: running ansible playbook setup-infrastructure.yml" -ssh root@$OPNFV_HOST_IP "openstack-ansible ${XCI_ANSIBLE_VERBOSITY} \ +ssh root@$OPNFV_HOST_IP "set -o pipefail; openstack-ansible ${XCI_ANSIBLE_VERBOSITY} \ releng-xci/.cache/repos/openstack-ansible/playbooks/setup-infrastructure.yml | tee setup-infrastructure.log" scp root@$OPNFV_HOST_IP:~/setup-infrastructure.log $LOG_PATH/setup-infrastructure.log echo "-----------------------------------------------------------------------" @@ -140,12 +140,12 @@ echo "Info: Verifying database cluster" echo "-----------------------------------------------------------------------" # Apply SUSE fix until https://review.openstack.org/508154 is merged if [[ ${OS_FAMILY,,} == "suse" ]]; then - ssh root@$OPNFV_HOST_IP "ansible --ssh-extra-args='-o StrictHostKeyChecking=no' \ + ssh root@$OPNFV_HOST_IP "set -o pipefail; ansible --ssh-extra-args='-o StrictHostKeyChecking=no' \ -i releng-xci/.cache/repos/openstack-ansible/playbooks/inventory/ galera_container -m shell \ -a \"sed -i \\\"s@/var/run/mysqld/mysqld.sock@/var/run/mysql/mysql.sock@\\\" /etc/my.cnf\"" fi -ssh root@$OPNFV_HOST_IP "ansible --ssh-extra-args='-o StrictHostKeyChecking=no' \ +ssh root@$OPNFV_HOST_IP "set -o pipefail; ansible --ssh-extra-args='-o StrictHostKeyChecking=no' \ -i releng-xci/.cache/repos/openstack-ansible/playbooks/inventory/ galera_container -m shell \ -a \"mysql -h localhost -e \\\"show status like '%wsrep_cluster_%';\\\"\" | tee galera.log" scp root@$OPNFV_HOST_IP:~/galera.log $LOG_PATH/galera.log @@ -164,7 +164,7 @@ echo "Info: Database cluster verification successful!" #------------------------------------------------------------------------------- echo "Info: Installing OpenStack on target hosts" echo "-----------------------------------------------------------------------" -ssh root@$OPNFV_HOST_IP "openstack-ansible ${XCI_ANSIBLE_VERBOSITY} \ +ssh root@$OPNFV_HOST_IP "set -o pipefail; openstack-ansible ${XCI_ANSIBLE_VERBOSITY} \ releng-xci/.cache/repos/openstack-ansible/playbooks/setup-openstack.yml | tee opnfv-setup-openstack.log" scp root@$OPNFV_HOST_IP:~/opnfv-setup-openstack.log $LOG_PATH/opnfv-setup-openstack.log echo "-----------------------------------------------------------------------" -- cgit 1.2.3-korg