X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=kubernetes%2Fhelm%2Fplugins%2Fundeploy%2Fundeploy.sh;h=dca4499aa1743bec1dde21cf8cc99d102f2f6997;hb=a64592e908c0d302cef785e8c048e60e57b2d568;hp=72c64244c0a579eca539d0090e423a163a7ef014;hpb=69abc8725b0c862ab06526034118402315f97093;p=oom.git diff --git a/kubernetes/helm/plugins/undeploy/undeploy.sh b/kubernetes/helm/plugins/undeploy/undeploy.sh index 72c64244c0..dca4499aa1 100755 --- a/kubernetes/helm/plugins/undeploy/undeploy.sh +++ b/kubernetes/helm/plugins/undeploy/undeploy.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh usage() { cat << EOF @@ -21,17 +21,20 @@ undeploy() { RELEASE=$1 FLAGS=$2 - array=($(helm ls -q --all | grep $RELEASE)) - n=${#array[*]} - for i in $(seq $(($n-1)) -1 0) + reverse_list= + for item in $(helm ls -q --all | grep $RELEASE) do - helm del "${array[i]}" $FLAGS + reverse_list="$item $reverse_list" + done + for item in $reverse_list + do + helm del $item $FLAGS done } -if [ $# < 1 ]; then +if [ -z "$1" ]; then echo "Error: command 'undeploy' requires a release name" - exit 0 + exit 1 fi case "${1:-"help"}" in