Skip to content

Commit 3924918

Browse files
authored
Merge pull request #215 from puppetlabs/SOLARCH-622
Improve reliability of downloading PE tarball
2 parents a55dc10 + 4965f43 commit 3924918

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tasks/download.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,18 @@ verify-file() {
3636

3737
download() {
3838
printf '%s\n' "Downloading: ${1}"
39-
curl -s -f -L -o "$2" "$1"
39+
tmp_file=$(mktemp)
40+
echo "Temporary file created at: ${tmp_file}"
41+
42+
if curl -s -f -L -o ${tmp_file} "$1"; then
43+
mv "${tmp_file}" "$2"
44+
return 0
45+
else
46+
echo "Error: Curl has failed to download the file"
47+
echo "Removing temporary file: ${tmp_file}"
48+
rm "${tmp_file}"
49+
return 1
50+
fi
4051
}
4152

4253
download-size-verify() {

0 commit comments

Comments
 (0)