Check for errors by default in scripts
[icn.git] / cmd / bpa-operator / e2etest / bpa_vm_verifier.sh
index 2d0ce08..e18de25 100755 (executable)
@@ -1,4 +1,5 @@
-#!/bin/bash
+#!/usr/bin/env bash
+set -eu -o pipefail
 
 CLUSTER_NAME=cluster-test
 
@@ -84,9 +85,7 @@ then
    KUBECONFIG=--kubeconfig=/opt/kud/multi-cluster/${CLUSTER_NAME}/artifacts/admin.conf
    APISERVER=$(kubectl ${KUBECONFIG} config view --minify -o jsonpath='{.clusters[0].cluster.server}')
    TOKEN=$(kubectl ${KUBECONFIG} get secret $(kubectl ${KUBECONFIG} get serviceaccount default -o jsonpath='{.secrets[0].name}') -o jsonpath='{.data.token}' | base64 --decode )
-   call_api $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure
-   ret=$?
-   if [[ $ret != 0 ]];
+   if ! call_api $APISERVER/api --header "Authorization: Bearer $TOKEN" --insecure;
    then
      printf "\nKubernetes Cluster Install did not complete successfully\n"
    else