[demo-vm-setup] added curl error handling Stop once it's clear the VBox appliance has failed to download: do not try to interpret S3 server output for HTTP 403 and other errors as a valid VBox appliance file.
Also made curl to follow HTTP redirects, if any. Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/6c30e2a0 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/6c30e2a0 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/6c30e2a0 Branch: refs/heads/master Commit: 6c30e2a05785b042d10de9cc5f827762bc6cd958 Parents: 95654d8 Author: Alexey Serbin <[email protected]> Authored: Fri Oct 28 17:34:31 2016 -0700 Committer: Alexey Serbin <[email protected]> Committed: Fri Oct 28 17:34:31 2016 -0700 ---------------------------------------------------------------------- demo-vm-setup/setup-kudu-demo-vm.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/6c30e2a0/demo-vm-setup/setup-kudu-demo-vm.sh ---------------------------------------------------------------------- diff --git a/demo-vm-setup/setup-kudu-demo-vm.sh b/demo-vm-setup/setup-kudu-demo-vm.sh index c1c5490..e1e7def 100755 --- a/demo-vm-setup/setup-kudu-demo-vm.sh +++ b/demo-vm-setup/setup-kudu-demo-vm.sh @@ -9,7 +9,8 @@ dir_resolve() } : ${VIRTUALBOX_NAME:=cloudera-quickstart-vm-5.8.0-kudu-virtualbox} -: ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${VIRTUALBOX_NAME}.ova} +OVF=${VIRTUALBOX_NAME}.ova +: ${VIRTUALBOX_URL:=http://cloudera-kudu-beta.s3.amazonaws.com/${OVF}} # VM Settings default. : ${VM_NAME:=kudu-demo} @@ -22,13 +23,15 @@ if ! which VBoxManage >/dev/null ; then exit 1 fi -# Download quickstart VM -OVF=${VIRTUALBOX_NAME}.ova -if [ -e ${VIRTUALBOX_NAME}.ova ]; then +# Download quickstart VM appliance +if [ -e ${OVF} ]; then echo Using previously downloaded image else echo "Downloading Virtualbox Image file: ${VIRTUALBOX_URL}" - curl -O ${VIRTUALBOX_URL} + if ! curl -fLSs ${VIRTUALBOX_URL} --output ${OVF}; then + echo "Failed to download VirtuaBox appliance from ${VIRTUALBOX_URL}" + exit 1 + fi fi # Set up the VM for the first time if it doesn't already exist.
