Simplify die_if_error
* Replace die_if_error() with the simpler die()
* Attempt to clean up unnecessary trace output
* Formatting cleanups on all exercise scripts
Change-Id: I72a542b3a59ee9bf12bee6bcc605edd7579205e0
diff --git a/exercises/bundle.sh b/exercises/bundle.sh
index a165d55..c607c94 100755
--- a/exercises/bundle.sh
+++ b/exercises/bundle.sh
@@ -1,11 +1,13 @@
#!/usr/bin/env bash
-# we will use the ``euca2ools`` cli tool that wraps the python boto
-# library to test ec2 compatibility
+# **bundle.sh**
-echo "**************************************************"
+# we will use the ``euca2ools`` cli tool that wraps the python boto
+# library to test ec2 bundle upload compatibility
+
+echo "*********************************************************************"
echo "Begin DevStack Exercise: $0"
-echo "**************************************************"
+echo "*********************************************************************"
# This script exits on an error so that errors don't compound and you see
# only the first error that occured.
@@ -46,12 +48,9 @@
BUCKET=testbucket
IMAGE=bundle.img
truncate -s 5M /tmp/$IMAGE
-euca-bundle-image -i /tmp/$IMAGE
-die_if_error "Failure bundling image $IMAGE"
+euca-bundle-image -i /tmp/$IMAGE || die "Failure bundling image $IMAGE"
-
-euca-upload-bundle -b $BUCKET -m /tmp/$IMAGE.manifest.xml
-die_if_error "Failure uploading bundle $IMAGE to $BUCKET"
+euca-upload-bundle -b $BUCKET -m /tmp/$IMAGE.manifest.xml || die "Failure uploading bundle $IMAGE to $BUCKET"
AMI=`euca-register $BUCKET/$IMAGE.manifest.xml | cut -f2`
die_if_not_set AMI "Failure registering $BUCKET/$IMAGE"
@@ -63,10 +62,9 @@
fi
# Clean up
-euca-deregister $AMI
-die_if_error "Failure deregistering $AMI"
+euca-deregister $AMI || die "Failure deregistering $AMI"
set +o xtrace
-echo "**************************************************"
-echo "End DevStack Exercise: $0"
-echo "**************************************************"
+echo "*********************************************************************"
+echo "SUCCESS: End DevStack Exercise: $0"
+echo "*********************************************************************"