From 922c8ae6804304841167fcca662726e1e26b556a Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 22 Oct 2013 10:06:06 -0400 Subject: [PATCH] clean up whitespace issues on exercises and friends Change-Id: I812a73e46ddd4d5fed4d304d9ef92c1de243f497 --- exercises/boot_from_volume.sh | 2 +- exercises/docker.sh | 3 +-- exercises/euca.sh | 42 +++++++++++++++++------------------ exercises/floating_ips.sh | 4 ++-- exercises/neutron-adv-test.sh | 24 ++++++++++---------- exercises/volumes.sh | 2 +- files/keystone_data.sh | 24 ++++++++++---------- tests/functions.sh | 8 +++---- 8 files changed, 54 insertions(+), 55 deletions(-) diff --git a/exercises/boot_from_volume.sh b/exercises/boot_from_volume.sh index fe27bd0956..634a6d526c 100755 --- a/exercises/boot_from_volume.sh +++ b/exercises/boot_from_volume.sh @@ -119,7 +119,7 @@ nova flavor-list INSTANCE_TYPE=$(nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | get_field 1) if [[ -z "$INSTANCE_TYPE" ]]; then # grab the first flavor in the list to launch if default doesn't exist - INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1) + INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1) fi # Clean-up from previous runs diff --git a/exercises/docker.sh b/exercises/docker.sh index 0672bc0087..10c5436c35 100755 --- a/exercises/docker.sh +++ b/exercises/docker.sh @@ -62,7 +62,7 @@ die_if_not_set $LINENO IMAGE "Failure getting image $DOCKER_IMAGE_NAME" INSTANCE_TYPE=$(nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | get_field 1) if [[ -z "$INSTANCE_TYPE" ]]; then # grab the first flavor in the list to launch if default doesn't exist - INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1) + INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1) fi # Clean-up from previous runs @@ -102,4 +102,3 @@ set +o xtrace echo "*********************************************************************" echo "SUCCESS: End DevStack Exercise: $0" echo "*********************************************************************" - diff --git a/exercises/euca.sh b/exercises/euca.sh index 64c0014236..ed521e4f7f 100755 --- a/exercises/euca.sh +++ b/exercises/euca.sh @@ -87,31 +87,31 @@ fi # Volumes # ------- if is_service_enabled c-vol && ! is_service_enabled n-cell; then - VOLUME_ZONE=`euca-describe-availability-zones | head -n1 | cut -f2` - die_if_not_set $LINENO VOLUME_ZONE "Failure to find zone for volume" + VOLUME_ZONE=`euca-describe-availability-zones | head -n1 | cut -f2` + die_if_not_set $LINENO VOLUME_ZONE "Failure to find zone for volume" - VOLUME=`euca-create-volume -s 1 -z $VOLUME_ZONE | cut -f2` - die_if_not_set $LINENO VOLUME "Failure to create volume" + VOLUME=`euca-create-volume -s 1 -z $VOLUME_ZONE | cut -f2` + die_if_not_set $LINENO VOLUME "Failure to create volume" - # Test that volume has been created - VOLUME=`euca-describe-volumes $VOLUME | cut -f2` - die_if_not_set $LINENO VOLUME "Failure to get volume" + # Test that volume has been created + VOLUME=`euca-describe-volumes $VOLUME | cut -f2` + die_if_not_set $LINENO VOLUME "Failure to get volume" - # Test volume has become available - if ! timeout $RUNNING_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q available; do sleep 1; done"; then - die $LINENO "volume didn't become available within $RUNNING_TIMEOUT seconds" - fi + # Test volume has become available + if ! timeout $RUNNING_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q available; do sleep 1; done"; then + die $LINENO "volume didn't become available within $RUNNING_TIMEOUT seconds" + fi - # Attach volume to an instance - euca-attach-volume -i $INSTANCE -d $ATTACH_DEVICE $VOLUME || \ - die $LINENO "Failure attaching volume $VOLUME to $INSTANCE" - if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -A 1 in-use | grep -q attach; do sleep 1; done"; then - die $LINENO "Could not attach $VOLUME to $INSTANCE" - fi + # Attach volume to an instance + euca-attach-volume -i $INSTANCE -d $ATTACH_DEVICE $VOLUME || \ + die $LINENO "Failure attaching volume $VOLUME to $INSTANCE" + if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -A 1 in-use | grep -q attach; do sleep 1; done"; then + die $LINENO "Could not attach $VOLUME to $INSTANCE" + fi - # Detach volume from an instance - euca-detach-volume $VOLUME || \ - die $LINENO "Failure detaching volume $VOLUME to $INSTANCE" + # Detach volume from an instance + euca-detach-volume $VOLUME || \ + die $LINENO "Failure detaching volume $VOLUME to $INSTANCE" if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q available; do sleep 1; done"; then die $LINENO "Could not detach $VOLUME to $INSTANCE" fi @@ -120,7 +120,7 @@ if is_service_enabled c-vol && ! is_service_enabled n-cell; then euca-delete-volume $VOLUME || \ die $LINENO "Failure to delete volume" if ! timeout $ACTIVE_TIMEOUT sh -c "while euca-describe-volumes | grep $VOLUME; do sleep 1; done"; then - die $LINENO "Could not delete $VOLUME" + die $LINENO "Could not delete $VOLUME" fi else echo "Volume Tests Skipped" diff --git a/exercises/floating_ips.sh b/exercises/floating_ips.sh index 2833b650ba..1a1608c872 100755 --- a/exercises/floating_ips.sh +++ b/exercises/floating_ips.sh @@ -113,7 +113,7 @@ nova flavor-list INSTANCE_TYPE=$(nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | get_field 1) if [[ -z "$INSTANCE_TYPE" ]]; then # grab the first flavor in the list to launch if default doesn't exist - INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1) + INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1) fi # Clean-up from previous runs @@ -168,7 +168,7 @@ if ! is_service_enabled neutron; then # list floating addresses if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova floating-ip-list | grep $TEST_FLOATING_POOL | grep -q $TEST_FLOATING_IP; do sleep 1; done"; then die $LINENO "Floating IP not allocated" - fi + fi fi # Dis-allow icmp traffic (ping) diff --git a/exercises/neutron-adv-test.sh b/exercises/neutron-adv-test.sh index e0c37ef723..7dfa5dc161 100755 --- a/exercises/neutron-adv-test.sh +++ b/exercises/neutron-adv-test.sh @@ -273,12 +273,12 @@ function create_vms { } function ping_ip { - # Test agent connection. Assumes namespaces are disabled, and - # that DHCP is in use, but not L3 - local VM_NAME=$1 - local NET_NAME=$2 - IP=$(get_instance_ip $VM_NAME $NET_NAME) - ping_check $NET_NAME $IP $BOOT_TIMEOUT + # Test agent connection. Assumes namespaces are disabled, and + # that DHCP is in use, but not L3 + local VM_NAME=$1 + local NET_NAME=$2 + IP=$(get_instance_ip $VM_NAME $NET_NAME) + ping_check $NET_NAME $IP $BOOT_TIMEOUT } function check_vm { @@ -330,12 +330,12 @@ function delete_network { } function delete_networks { - foreach_tenant_net 'delete_network ${%TENANT%_NAME} %NUM%' - #TODO(nati) add secuirty group check after it is implemented - # source $TOP_DIR/openrc demo1 demo1 - # nova secgroup-delete-rule default icmp -1 -1 0.0.0.0/0 - # source $TOP_DIR/openrc demo2 demo2 - # nova secgroup-delete-rule default icmp -1 -1 0.0.0.0/0 + foreach_tenant_net 'delete_network ${%TENANT%_NAME} %NUM%' + # TODO(nati) add secuirty group check after it is implemented + # source $TOP_DIR/openrc demo1 demo1 + # nova secgroup-delete-rule default icmp -1 -1 0.0.0.0/0 + # source $TOP_DIR/openrc demo2 demo2 + # nova secgroup-delete-rule default icmp -1 -1 0.0.0.0/0 } function create_all { diff --git a/exercises/volumes.sh b/exercises/volumes.sh index e536d16249..9ee9fa910a 100755 --- a/exercises/volumes.sh +++ b/exercises/volumes.sh @@ -117,7 +117,7 @@ nova flavor-list INSTANCE_TYPE=$(nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | get_field 1) if [[ -z "$INSTANCE_TYPE" ]]; then # grab the first flavor in the list to launch if default doesn't exist - INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1) + INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1) fi # Clean-up from previous runs diff --git a/files/keystone_data.sh b/files/keystone_data.sh index 3f3137cb14..ea2d52d114 100755 --- a/files/keystone_data.sh +++ b/files/keystone_data.sh @@ -66,12 +66,12 @@ fi # Heat if [[ "$ENABLED_SERVICES" =~ "heat" ]]; then HEAT_USER=$(get_id keystone user-create --name=heat \ - --pass="$SERVICE_PASSWORD" \ - --tenant_id $SERVICE_TENANT \ - --email=heat@example.com) + --pass="$SERVICE_PASSWORD" \ + --tenant_id $SERVICE_TENANT \ + --email=heat@example.com) keystone user-role-add --tenant-id $SERVICE_TENANT \ - --user-id $HEAT_USER \ - --role-id $SERVICE_ROLE + --user-id $HEAT_USER \ + --role-id $SERVICE_ROLE # heat_stack_user role is for users created by Heat keystone role-create --name heat_stack_user if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then @@ -126,16 +126,16 @@ fi # Ceilometer if [[ "$ENABLED_SERVICES" =~ "ceilometer" ]]; then CEILOMETER_USER=$(get_id keystone user-create --name=ceilometer \ - --pass="$SERVICE_PASSWORD" \ - --tenant_id $SERVICE_TENANT \ - --email=ceilometer@example.com) + --pass="$SERVICE_PASSWORD" \ + --tenant_id $SERVICE_TENANT \ + --email=ceilometer@example.com) keystone user-role-add --tenant-id $SERVICE_TENANT \ - --user-id $CEILOMETER_USER \ - --role-id $ADMIN_ROLE + --user-id $CEILOMETER_USER \ + --role-id $ADMIN_ROLE # Ceilometer needs ResellerAdmin role to access swift account stats. keystone user-role-add --tenant-id $SERVICE_TENANT \ - --user-id $CEILOMETER_USER \ - --role-id $RESELLER_ROLE + --user-id $CEILOMETER_USER \ + --role-id $RESELLER_ROLE if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then CEILOMETER_SERVICE=$(get_id keystone service-create \ --name=ceilometer \ diff --git a/tests/functions.sh b/tests/functions.sh index 7d486d4cc5..40376aa63f 100755 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -122,16 +122,16 @@ fi # test empty option if ini_has_option test.ini ddd empty; then - echo "OK: ddd.empty present" + echo "OK: ddd.empty present" else - echo "ini_has_option failed: ddd.empty not found" + echo "ini_has_option failed: ddd.empty not found" fi # test non-empty option if ini_has_option test.ini bbb handlers; then - echo "OK: bbb.handlers present" + echo "OK: bbb.handlers present" else - echo "ini_has_option failed: bbb.handlers not found" + echo "ini_has_option failed: bbb.handlers not found" fi # test changing empty option