[COMMON] Fix deploy.sh/undeploy.sh scripts
[oom.git] / kubernetes / helm / plugins / undeploy / undeploy.sh
index e5c0c12..a3b0e3c 100755 (executable)
@@ -23,15 +23,15 @@ undeploy() {
 
   array=($(helm ls -q --all | grep $RELEASE))
   n=${#array[*]}
-  for (( i = n-1; i >= 0; i-- ))
+  for i in $(seq $(($n-1)) -1 0)
   do
     helm del "${array[i]}" $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
@@ -45,8 +45,8 @@ case "${1:-"help"}" in
     usage
     ;;
   *)
-    undeploy $1 ${@:2}
+    undeploy $1 $(echo ${@} | sed 's/^ *[^ ]* *//')
     ;;
 esac
 
-exit 0
\ No newline at end of file
+exit 0