diff options
author | Mandeep Khinda <Mandeep.Khinda@amdocs.com> | 2017-09-12 17:03:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-12 17:03:15 +0000 |
commit | d93f13b14a49e10f036e1d9014ff7909ea504570 (patch) | |
tree | 47935f2359d3426ae2a73b32149a93803fc0b3c3 /kubernetes/oneclick | |
parent | 340d0bf4867a5890956c752b596372ec2d5d3005 (diff) | |
parent | 213d2ef686c5988a32292346dee488462ae76c49 (diff) |
Merge "Improve error handling"
Diffstat (limited to 'kubernetes/oneclick')
-rwxr-xr-x | kubernetes/oneclick/createAll.bash | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/kubernetes/oneclick/createAll.bash b/kubernetes/oneclick/createAll.bash index 7b8e2f8886..7be2e6a7de 100755 --- a/kubernetes/oneclick/createAll.bash +++ b/kubernetes/oneclick/createAll.bash @@ -18,12 +18,25 @@ Usage: $0 [PARAMs] EOF } +check_return_code(){ + ret=$? + if [ $ret -ne 0 ]; then + printf "The command $1 returned with error code $ret \n" 1>&2 + exit $ret + fi +} + + create_namespace() { - kubectl create namespace $1-$2 + cmd=`echo kubectl create namespace $1-$2` + eval ${cmd} + check_return_code $cmd } create_registry_key() { - kubectl --namespace $1-$2 create secret docker-registry $3 --docker-server=$4 --docker-username=$5 --docker-password=$6 --docker-email=$7 + cmd=`echo kubectl --namespace $1-$2 create secret docker-registry $3 --docker-server=$4 --docker-username=$5 --docker-password=$6 --docker-email=$7` + eval ${cmd} + check_return_code $cmd } create_onap_helm() { @@ -31,10 +44,11 @@ create_onap_helm() { if [[ ! -z $HELM_VALUES_FILEPATH ]]; then HELM_VALUES_ADDITION="--values=$HELM_VALUES_FILEPATH" fi - helm install $LOCATION/$2/ --name $1-$2 --namespace $1 --set nsPrefix=$1,nodePortPrefix=$3 ${HELM_VALUES_ADDITION} + cmd=`echo helm install $LOCATION/$2/ --name $1-$2 --namespace $1 --set nsPrefix=$1,nodePortPrefix=$3 ${HELM_VALUES_ADDITION}` + eval ${cmd} + check_return_code $cmd } - #MAINs NS= HELM_VALUES_FILEPATH="" |