summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFatih Degirmenci <fdegir@gmail.com>2018-03-14 08:36:56 +0100
committerFatih Degirmenci <fdegir@gmail.com>2018-03-14 07:39:03 +0000
commitdc64b4278c4245713e9e38742108d4d5ea77e035 (patch)
tree565ae0b729e4fb8c8e2d91c5d2c36c5e9f046688
parent69de8e681a4510030aea1037f0c0dca17727205d (diff)
kubespray: Do not grep log text to determine failure
Pipefail should be sufficient to determine the failure so this change gets rid of grepping the logs for failure and unreachable to leave the evaluation to bash itself. Change-Id: I0fcd6016ddc19eb11b3eb2402347032a11c5a32a Signed-off-by: Fatih Degirmenci <fdegir@gmail.com>
-rwxr-xr-xxci/installer/kubespray/deploy.sh11
1 files changed, 4 insertions, 7 deletions
diff --git a/xci/installer/kubespray/deploy.sh b/xci/installer/kubespray/deploy.sh
index 548ed771..b68fec90 100755
--- a/xci/installer/kubespray/deploy.sh
+++ b/xci/installer/kubespray/deploy.sh
@@ -7,11 +7,13 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+set -o errexit
+set -o nounset
+set -o pipefail
K8_XCI_PLAYBOOKS="$(dirname $(realpath ${BASH_SOURCE[0]}))/playbooks"
export ANSIBLE_ROLES_PATH=$HOME/.ansible/roles:/etc/ansible/roles:${XCI_PATH}/xci/playbooks/roles
-
#-------------------------------------------------------------------------------
# Configure localhost
#-------------------------------------------------------------------------------
@@ -72,14 +74,9 @@ fi
echo "Info: Using kubespray to deploy the kubernetes cluster"
echo "-----------------------------------------------------------------------"
-ssh root@$OPNFV_HOST_IP "cd releng-xci/.cache/repos/kubespray;\
+ssh root@$OPNFV_HOST_IP "set -o pipefail; cd releng-xci/.cache/repos/kubespray;\
ansible-playbook ${XCI_ANSIBLE_PARAMS} \
-i opnfv_inventory/inventory.cfg cluster.yml -b | tee setup-kubernetes.log"
scp root@$OPNFV_HOST_IP:~/releng-xci/.cache/repos/kubespray/setup-kubernetes.log \
$LOG_PATH/setup-kubernetes.log
-# check the log to see if we have any error
-if grep -q 'failed=1\|unreachable=1' $LOG_PATH/setup-kubernetes.log; then
- echo "Error: Kubernetes cluster setup failed!"
- exit 1
-fi
echo "Info: Kubernetes installation is successfully completed!"