Skip to content

Improve reliability of downloading PE tarball #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 28, 2021
11 changes: 10 additions & 1 deletion tasks/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ verify-file() {

download() {
printf '%s\n' "Downloading: ${1}"
curl -s -f -L -o "$2" "$1"
tmp_file=$(mktemp "peadm-download")
echo "Temporary file created at: ${tmp_file}"
curl -s -f -L -o ${tmp_file} "$1"
if [ tar -tzf "${tmp_file}" >/dev/null ]; then
mv "${tmp_file}" "$2"
else
echo "Puppet Enterprise download failed: Invalid tarball"
echo "|_ Removing temporary file: ${tmp_file}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a typo?

Suggested change
echo "|_ Removing temporary file: ${tmp_file}"
echo "Removing temporary file: ${tmp_file}"

rm "${tmp_file}"
fi
}

download-size-verify() {
Expand Down