From fb656718fbf3d9c91d29d9c9f62fda43b8a65dd6 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Tue, 30 Apr 2019 10:12:51 +0100 Subject: [PATCH] Makes image caching more resilient Avoids failing on the first attempt to download the image to cache as mirrors hosting them can randomly go down, usually with a connection refused. Change-Id: I9de9f33c2cc16596d04b35c4eb92621e6a2c7511 --- diskimage_builder/elements/cache-url/bin/cache-url | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diskimage_builder/elements/cache-url/bin/cache-url b/diskimage_builder/elements/cache-url/bin/cache-url index 50b4d63fc..cd260d487 100755 --- a/diskimage_builder/elements/cache-url/bin/cache-url +++ b/diskimage_builder/elements/cache-url/bin/cache-url @@ -61,7 +61,7 @@ done url=$1 dest=$2 time_cond= -curl_opts="" +curl_opts="--retry 3 --retry-delay 30 " if [ -z $url -o -z $dest ] ; then show_options 1 @@ -77,7 +77,7 @@ else fi if [ "$FORCE_REVALIDATE" = "1" ]; then - curl_opts="-H 'Pragma: no-cache, must-revalidate' -H 'Cache-Control: no-cache, must-revalidate'" + curl_opts+="-H 'Pragma: no-cache, must-revalidate' -H 'Cache-Control: no-cache, must-revalidate'" success="Downloaded and cached $url, having forced upstream caches to revalidate" elif [ -f $dest -a -s $dest ] ; then time_cond="-z $dest"