From 5ee9d59563df622806b9e2c852184d5834c13789 Mon Sep 17 00:00:00 2001 From: weizhoublue <45163302+weizhoublue@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:34:52 +0800 Subject: [PATCH] Merge pull request #4293 from ty-dc/fix/install-openxx fix: after the installation of openvswitch failed, retrying did not work. Signed-off-by: robot --- test/scripts/install-ovs.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/test/scripts/install-ovs.sh b/test/scripts/install-ovs.sh index c24bffaf5..5be9e212a 100644 --- a/test/scripts/install-ovs.sh +++ b/test/scripts/install-ovs.sh @@ -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"