File tree Expand file tree Collapse file tree
parts/linux/cloud-init/artifacts
spec/parts/linux/cloud-init/artifacts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1004,19 +1004,19 @@ NETWORKD_EOF
10041004 echo " Configured secondary NIC ${iface_name} (mac=${mac} , metric=${metric} )"
10051005 done
10061006
1007- # Apply all configs in a single operation to avoid repeated network restarts
1007+ # Apply all configs in a single operation to avoid repeated network restarts.
10081008 if [ " $is_netplan " = true ]; then
1009- if ! netplan apply; then
1009+ if ! retrycmd_if_failure 5 3 10 netplan apply; then
10101010 echo " Failed to apply netplan config for secondary NICs" >&2
10111011 return $ERR_SECONDARY_NIC_CONFIG_FAIL
10121012 fi
10131013 else
1014- if ! networkctl reload; then
1014+ if ! retrycmd_if_failure 5 3 10 networkctl reload; then
10151015 echo " Failed to reload networkd for secondary NICs" >&2
10161016 return $ERR_SECONDARY_NIC_CONFIG_FAIL
10171017 fi
10181018 for i in $( seq 1 $(( nic_count - 1 )) ) ; do
1019- if ! networkctl up " eth${i} " ; then
1019+ if ! retrycmd_if_failure 5 3 10 networkctl up " eth${i} " ; then
10201020 echo " Failed to bring up eth${i} " >&2
10211021 return $ERR_SECONDARY_NIC_CONFIG_FAIL
10221022 fi
Original file line number Diff line number Diff line change @@ -169,6 +169,11 @@ Describe 'cse_config.sh'
169169 networkctl () {
170170 echo " networkctl $@ "
171171 }
172+ retrycmd_if_failure () {
173+ echo " retrycmd_if_failure $@ "
174+ shift 3
175+ " $@ "
176+ }
172177
173178 It ' should skip when only a single NIC is present'
174179 IMDS_INSTANCE_METADATA_CACHE_FILE=" spec/parts/linux/cloud-init/artifacts/imds_mocks/network/single_nic.json"
You can’t perform that action at this time.
0 commit comments