diff options
author | guillaume.lambert <guillaume.lambert@orange.com> | 2022-01-03 14:46:22 +0100 |
---|---|---|
committer | guillaume.lambert <guillaume.lambert@orange.com> | 2022-05-03 11:02:25 +0200 |
commit | 8e9a392b2d1562184777ce1522eafc3903e964fe (patch) | |
tree | 18259d66eec264cb420622c7eb6351d9e88c03d4 | |
parent | 9a62578638e21ecc0c12be240af6365b3e84a416 (diff) |
[COMMON] Fix more and more array bashisms step 1
pointed out by checkbashisms.
Issue-ID: OOM-2643
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I8c78bb6617c8f0fdaed9933c1c5897598db7428a
-rwxr-xr-x | kubernetes/helm/plugins/deploy/deploy.sh | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/kubernetes/helm/plugins/deploy/deploy.sh b/kubernetes/helm/plugins/deploy/deploy.sh index 36853baa1f..858a5e0b7d 100755 --- a/kubernetes/helm/plugins/deploy/deploy.sh +++ b/kubernetes/helm/plugins/deploy/deploy.sh @@ -284,14 +284,19 @@ deploy() { if [ $SUBCHART_ENABLED -eq 1 ]; then deploy_subchart else - array=($(echo "$ALL_HELM_RELEASES" | grep "${RELEASE}-${subchart}")) - n=${#array[*]} - for i in $(seq $(($n-1)) -1 0); do - helm del "${array[i]}" + reverse_list= + for item in $(echo "$ALL_HELM_RELEASES" | grep "${RELEASE}-${subchart}") + do + reverse_list="$item $reverse_list" + done + for item in $reverse_list + do + helm del $item done fi done + for subchart in * ; do SUBCHART_OVERRIDES=$CACHE_SUBCHART_DIR/$subchart/subchart-overrides.yaml @@ -306,10 +311,14 @@ deploy() { if [ $SUBCHART_ENABLED -eq 1 ]; then deploy_subchart else - array=($(echo "$ALL_HELM_RELEASES" | grep "${RELEASE}-${subchart}")) - n=${#array[*]} - for i in $(seq $(($n-1)) -1 0); do - helm del "${array[i]}" + reverse_list= + for item in $(echo "$ALL_HELM_RELEASES" | grep "${RELEASE}-${subchart}") + do + reverse_list="$item $reverse_list" + done + for item in $reverse_list + do + helm del $item done fi done |