Skip to content

Commit

Permalink
Merge pull request #4326 from spidernet-io/robot/cherrypick/pr4293/re…
Browse files Browse the repository at this point in the history
…lease-v1.0

fix: after the installation of openvswitch failed, retrying did not work.
  • Loading branch information
weizhoublue authored Nov 27, 2024
2 parents 0044fe0 + 5ee9d59 commit 2acf4c2
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions test/scripts/install-ovs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,24 @@ for NODE in $KIND_NODES; do
install_openvswitch() {
for attempt in {1..5}; do
echo "Attempt $attempt to install openvswitch on ${NODE}..."
docker exec ${NODE} apt-get update > /dev/null
docker exec ${NODE} apt-get install -y apt-utils > /dev/null
docker exec ${NODE} apt-get install -y openvswitch-switch > /dev/null
if ! docker exec ${NODE} apt-get update > /dev/null; then
echo "Failed to update package list on ${NODE}, retrying in 10s..."
sleep 10
continue
fi

if [[ $? -eq 0 ]]; then
echo "Openvswitch installed successfully on ${NODE}"
return 0
if ! docker exec ${NODE} apt-get install -y openvswitch-switch > /dev/null; then
echo "Failed to install openvswitch on ${NODE}, retrying in 10s..."
sleep 10
continue
fi

echo "Failed to install openvswitch on ${NODE}, retrying in 10s..."
sleep 10
echo "Succeed to install openvswitch on ${NODE}"
return 0
done
echo "Error: Failed to install openvswitch on ${NODE} after 5 attempts"
exit 1

echo "Error: Failed to install openvswitch on ${NODE} after 5 attempts." >&2
return 1
}

echo "=========install openvswitch"
Expand Down

0 comments on commit 2acf4c2

Please sign in to comment.