Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: tzssangglass <[email protected]>
  • Loading branch information
tzssangglass committed May 30, 2024
1 parent 9ab0de8 commit 5f82ab2
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions scripts/explain_manifest/test-uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#!/bin/bash
set -e

image=$1
label=$2

container_id=$(docker run -d --entrypoint "/bin/bash" "$image" -c "tail -f /dev/null")

cleanup() {
docker stop "$container_id" >/dev/null 2>&1
docker rm "$container_id" >/dev/null 2>&1
}

trap cleanup EXIT

remove_kong_command() {
local remove_cmd=""

Expand All @@ -28,12 +33,7 @@ if ! remove_cmd=$(remove_kong_command); then
exit 1
fi

if ! docker exec -u root "$container_id" bash -c "$remove_cmd" > /dev/null 2>&1; then
echo "Failed to remove Kong"
docker stop --time 1 "$container_id" > /dev/null 2>&1
docker rm "$container_id" > /dev/null 2>&1
exit 1
fi
docker exec -u root "$container_id" bash -c "$remove_cmd" >/dev/null 2>&1

dir=(
"/usr/local/kong/include"
Expand All @@ -48,9 +48,8 @@ do
result=$?
if [ $result -eq 0 ]; then
echo "Failed to uninstall Kong, $d still exists"
break
exit 1
fi
done

docker stop --time 1 "$container_id" > /dev/null 2>&1
docker rm "$container_id" > /dev/null 2>&1
exit 0

0 comments on commit 5f82ab2

Please sign in to comment.