Specify file url when deploy-artifacts fails
[apex-tripleo-heat-templates.git] / puppet / deploy-artifacts.sh
1 #!/bin/bash
2
3 TMP_DATA=$(mktemp -d)
4 function cleanup {
5   rm -Rf "$TMP_DATA"
6 }
7 trap cleanup EXIT
8
9 if [ -n "$artifact_urls" ]; then
10   for URL in $(echo $artifact_urls | sed -e "s| |\n|g" | sort -u); do
11     curl --globoff -o $TMP_DATA/file_data "$URL"
12     if file -b $TMP_DATA/file_data | grep RPM &>/dev/null; then
13       yum install -y $TMP_DATA/file_data
14     elif file -b $TMP_DATA/file_data | grep 'gzip compressed data' &>/dev/null; then
15       pushd /
16       tar xvzf $TMP_DATA/file_data
17       popd
18     else
19       echo "ERROR: Unsupported file format: $URL"
20       exit 1
21     fi
22     rm $TMP_DATA/file_data
23   done
24 else
25   echo "No artifact_urls was set. Skipping..."
26 fi