Really handle Ubuntu mirror cache skew,
The last patch to do this only handled the case of SHA256SUM being stale, but the image is more likely to be stale in the default configuration as the hash file is downloaded over HTTPS. Change-Id: I6531fa684e560cad48c3696394d48a600680c875 Closes-Bug: #1336067
This commit is contained in:
parent
3cdfd9565e
commit
eca284cab7
@ -24,10 +24,17 @@ else
|
|||||||
$TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$DIB_RELEASE/current/$BASE_IMAGE_FILE $CACHED_FILE
|
$TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$DIB_RELEASE/current/$BASE_IMAGE_FILE $CACHED_FILE
|
||||||
pushd $DIB_IMAGE_CACHE
|
pushd $DIB_IMAGE_CACHE
|
||||||
if ! grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - ; then
|
if ! grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - ; then
|
||||||
# It is likely that an upstream http(s) proxy has given us a new image, but stale sha256sums
|
# It is likely that an upstream http(s) proxy has given us a skewed
|
||||||
# Try again. Harder.
|
# result - either a cached SHA file or a cached image. Use cache-busting
|
||||||
|
# to get (as long as caches are compliant...) fresh files.
|
||||||
|
# Try the sha256sum first, just in case that is the stale one (avoiding
|
||||||
|
# downloading the larger image), and then if the sums still fail retry
|
||||||
|
# the image.
|
||||||
$TMP_HOOKS_PATH/bin/cache-url -f $SHA256SUMS $CACHED_SUMS
|
$TMP_HOOKS_PATH/bin/cache-url -f $SHA256SUMS $CACHED_SUMS
|
||||||
grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check -
|
if ! grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check - ; then
|
||||||
|
$TMP_HOOKS_PATH/bin/cache-url -f $DIB_CLOUD_IMAGES/$DIB_RELEASE/current/$BASE_IMAGE_FILE $CACHED_FILE
|
||||||
|
grep "$BASE_IMAGE_FILE" $CACHED_SUMS | sha256sum --check -
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user