Exercise cleanup
* Make common steps consistent
* Make comments consistent
aggregates.sh
boot_from_volume.sh
client-args.sh
client-env.sh
euca.sh
floating_ips.sh
sec_groups.sh
swift.sh
volumes.sh
Change-Id: Ib93dcdfdead93c259e3cd184fbc5ccc0a4a87c9a
diff --git a/exercises/aggregates.sh b/exercises/aggregates.sh
index deb1a03..ae3198f 100755
--- a/exercises/aggregates.sh
+++ b/exercises/aggregates.sh
@@ -39,9 +39,8 @@
# Import exercise configuration
source $TOP_DIR/exerciserc
-# run test as the admin user
-_OLD_USERNAME=$OS_USERNAME
-OS_USERNAME=admin
+# Test as the admin user
+. openrc admin admin
# Create an aggregate
@@ -54,7 +53,7 @@
exit_if_aggregate_present() {
aggregate_name=$1
- if [ `nova aggregate-list | grep -c " $aggregate_name "` == 0 ]; then
+ if [ $(nova aggregate-list | grep -c " $aggregate_name ") == 0 ]; then
echo "SUCCESS $aggregate_name not present"
else
echo "ERROR found aggregate: $aggregate_name"
@@ -64,8 +63,8 @@
exit_if_aggregate_present $AGGREGATE_NAME
-AGGREGATE_ID=`nova aggregate-create $AGGREGATE_NAME $AGGREGATE_A_ZONE | grep " $AGGREGATE_NAME " | get_field 1`
-AGGREGATE2_ID=`nova aggregate-create $AGGREGATE2_NAME $AGGREGATE_A_ZONE | grep " $AGGREGATE2_NAME " | get_field 1`
+AGGREGATE_ID=$(nova aggregate-create $AGGREGATE_NAME $AGGREGATE_A_ZONE | grep " $AGGREGATE_NAME " | get_field 1)
+AGGREGATE2_ID=$(nova aggregate-create $AGGREGATE2_NAME $AGGREGATE_A_ZONE | grep " $AGGREGATE2_NAME " | get_field 1)
# check aggregate created
nova aggregate-list | grep -q " $AGGREGATE_NAME " || die "Aggregate $AGGREGATE_NAME not created"
@@ -125,7 +124,7 @@
if [ "$VIRT_DRIVER" == "xenserver" ]; then
echo "TODO(johngarbutt) add tests for add/remove host from pool aggregate"
fi
-FIRST_HOST=`nova host-list | grep compute | get_field 1 | head -1`
+FIRST_HOST=$(nova host-list | grep compute | get_field 1 | head -1)
# Make sure can add two aggregates to same host
nova aggregate-add-host $AGGREGATE_ID $FIRST_HOST
nova aggregate-add-host $AGGREGATE2_ID $FIRST_HOST
@@ -142,12 +141,6 @@
nova aggregate-delete $AGGREGATE2_ID
exit_if_aggregate_present $AGGREGATE_NAME
-
-# Test complete
-# =============
-OS_USERNAME=$_OLD_USERNAME
-echo "AGGREGATE TEST PASSED"
-
set +o xtrace
echo "**************************************************"
echo "End DevStack Exercise: $0"