Allow skip files when download logs

Allow skip files that fail to get the contents during downloading logs.

Will show in command message to let downloader knows what file we skips,
so downloader can try to download it manually if they prefer.

Change-Id: Ic87e1e2f1ef656b4d0615fa6fb68a1ed9067a956
This commit is contained in:
ricolin 2020-09-15 14:06:07 +08:00
parent ca4111a586
commit 5505fda9ac
1 changed files with 5 additions and 1 deletions

View File

@ -63,6 +63,7 @@ EOF
}
function save_file {
local exit_code=0
local base_url="$1"
local file="$2"
local xtra_args="--compressed"
@ -73,7 +74,10 @@ function save_file {
if [[ "${file}" == *.xz ]]; then
xtra_args=""
fi
curl -s ${xtra_args} --create-dirs -o "${file}" "${base_url}${file}"
curl -s ${xtra_args} --create-dirs -o "${file}" "${base_url}${file}" || exit_code=$?
if [[ $exit_code -ne 0 ]]; then
log "Failed to download ${base_url}{$file}; skipping"
fi
{#
# Using --compressed we will send an Accept-Encoding: gzip header
# and the data will come to us across the network compressed.