From ed5a97290fd95ce3ac1f62e22fb17ac9f1f2afa3 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 4 Jun 2014 11:04:05 +1000 Subject: [PATCH] Make install_puppet.sh more robust against failure I hit an issue with a system with curl *and* wget installed. The curl download failed, leaving a corrupt get-pip.py and thus the wget download started (which then saved to get-pip.py.1). The script then tried to run the corrupt version. Although re-running is uncommon unless you're manually deploying the scripts, best to also check for the file first or these commands both re-download to get-pip.py.X Change-Id: I6b70b4b7bb3d963ba70d71388c701951932e9adb --- install_puppet.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/install_puppet.sh b/install_puppet.sh index 5c71032a8f..b2b742c644 100755 --- a/install_puppet.sh +++ b/install_puppet.sh @@ -19,7 +19,22 @@ # Install pip using get-pip PIP_GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py -curl -O $PIP_GET_PIP_URL || wget $PIP_GET_PIP_URL +ret=1 +if [ -f ./get-pip.py ]; then + ret=0 +elif type curl >/dev/null 2>&1; then + curl -O $PIP_GET_PIP_URL + ret=$? +elif type wget >/dev/null 2>&1; then + wget $PIP_GET_PIP_URL + ret=$? +fi + +if [ $ret -ne 0 ]; then + echo "Failed to get get-pip.py" + exit 1 +fi + python get-pip.py # Install puppet version 2.7.x from puppetlabs.