Skip to content

Commit b3ef979

Browse files
retry ubuntu image download on temp error (kubernetes#2507)
Co-authored-by: kayrus <[email protected]>
1 parent 13170a3 commit b3ef979

File tree

1 file changed

+10
-1
lines changed
  • tests/playbooks/roles/install-k3s/tasks

1 file changed

+10
-1
lines changed

tests/playbooks/roles/install-k3s/tasks/main.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,17 @@
1616
1717
set +x; source openrc admin admin > /dev/null; set -x
1818
openstack image show {{ image_name }} > /dev/null 2>&1
19+
1920
if [[ "$?" != "0" ]]; then
20-
curl -sSL {{ image_url }} -o {{ image_name }}.img
21+
# retry ubuntu image download on failure,
22+
# e.g. "curl: (35) OpenSSL SSL_connect: Connection reset by peer in connection to cloud-images.ubuntu.com:443"
23+
tries=0
24+
until [ "$tries" -ge 5 ]; do
25+
curl -sSL {{ image_url }} -o {{ image_name }}.img && break
26+
echo "Error downloading an image"
27+
((tries++))
28+
sleep 10
29+
done
2130
openstack image create {{ image_name }} --container-format bare --disk-format qcow2 --public --file {{ image_name }}.img
2231
fi
2332

0 commit comments

Comments
 (0)