From 0b865a55f2b6fa1435e8bf6df09218a9bf7a0ca0 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 22 Oct 2013 11:37:35 -0400 Subject: [PATCH] final bash8 files for the rest of devstack With this devstack/master is bash8 clean, and ready for enforcement Change-Id: I03fc89b401e6b7a23224d71472122c1bfa3ad0bd --- tools/build_bm_multi.sh | 4 +- tools/build_uec.sh | 6 +- tools/create_userrc.sh | 8 +- tools/jenkins/jenkins_home/build_jenkins.sh | 16 +-- tools/xen/install_os_domU.sh | 10 +- tools/xen/scripts/install-os-vpx.sh | 110 ++++++++++---------- tools/xen/scripts/uninstall-os-vpx.sh | 58 +++++------ 7 files changed, 106 insertions(+), 106 deletions(-) diff --git a/tools/build_bm_multi.sh b/tools/build_bm_multi.sh index 52b9b4ea32..328d5762fc 100755 --- a/tools/build_bm_multi.sh +++ b/tools/build_bm_multi.sh @@ -22,8 +22,8 @@ run_bm STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vn if [ ! "$TERMINATE" = "1" ]; then echo "Waiting for head node ($HEAD_HOST) to start..." if ! timeout 60 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then - echo "Head node did not start" - exit 1 + echo "Head node did not start" + exit 1 fi fi diff --git a/tools/build_uec.sh b/tools/build_uec.sh index 6c4a26c2e3..bce051a0b7 100755 --- a/tools/build_uec.sh +++ b/tools/build_uec.sh @@ -229,8 +229,8 @@ EOF # (re)start a metadata service ( - pid=`lsof -iTCP@192.168.$GUEST_NETWORK.1:4567 -n | awk '{print $2}' | tail -1` - [ -z "$pid" ] || kill -9 $pid + pid=`lsof -iTCP@192.168.$GUEST_NETWORK.1:4567 -n | awk '{print $2}' | tail -1` + [ -z "$pid" ] || kill -9 $pid ) cd $vm_dir/uec python meta.py 192.168.$GUEST_NETWORK.1:4567 & @@ -268,7 +268,7 @@ if [ "$WAIT_TILL_LAUNCH" = "1" ]; then sleep 2 while [ ! -e "$vm_dir/console.log" ]; do - sleep 1 + sleep 1 done tail -F $vm_dir/console.log & diff --git a/tools/create_userrc.sh b/tools/create_userrc.sh index 44b0f6bba0..8383fe7d77 100755 --- a/tools/create_userrc.sh +++ b/tools/create_userrc.sh @@ -105,15 +105,15 @@ if [ -z "$OS_PASSWORD" ]; then fi if [ -z "$OS_TENANT_NAME" -a -z "$OS_TENANT_ID" ]; then - export OS_TENANT_NAME=admin + export OS_TENANT_NAME=admin fi if [ -z "$OS_USERNAME" ]; then - export OS_USERNAME=admin + export OS_USERNAME=admin fi if [ -z "$OS_AUTH_URL" ]; then - export OS_AUTH_URL=http://localhost:5000/v2.0/ + export OS_AUTH_URL=http://localhost:5000/v2.0/ fi USER_PASS=${USER_PASS:-$OS_PASSWORD} @@ -249,7 +249,7 @@ if [ $MODE != "create" ]; then for user_id_at_name in `keystone user-list --tenant-id $tenant_id | awk 'BEGIN {IGNORECASE = 1} /true[[:space:]]*\|[^|]*\|$/ {print $2 "@" $4}'`; do read user_id user_name <<< `echo "$user_id_at_name" | sed 's/@/ /'` if [ $MODE = one -a "$user_name" != "$USER_NAME" ]; then - continue; + continue; fi add_entry "$user_id" "$user_name" "$tenant_id" "$tenant_name" "$USER_PASS" done diff --git a/tools/jenkins/jenkins_home/build_jenkins.sh b/tools/jenkins/jenkins_home/build_jenkins.sh index e0e774ee9e..a556db0f1d 100755 --- a/tools/jenkins/jenkins_home/build_jenkins.sh +++ b/tools/jenkins/jenkins_home/build_jenkins.sh @@ -6,8 +6,8 @@ set -o errexit # Make sure only root can run our script if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" - exit 1 + echo "This script must be run as root" + exit 1 fi # This directory @@ -31,15 +31,15 @@ apt-get install -y --force-yes $DEPS # Install jenkins if [ ! -e /var/lib/jenkins ]; then - echo "Jenkins installation failed" - exit 1 + echo "Jenkins installation failed" + exit 1 fi # Make sure user has configured a jenkins ssh pubkey if [ ! -e /var/lib/jenkins/.ssh/id_rsa.pub ]; then - echo "Public key for jenkins is missing. This is used to ssh into your instances." - echo "Please run "su -c ssh-keygen jenkins" before proceeding" - exit 1 + echo "Public key for jenkins is missing. This is used to ssh into your instances." + echo "Please run "su -c ssh-keygen jenkins" before proceeding" + exit 1 fi # Setup sudo @@ -96,7 +96,7 @@ PLUGINS=http://hudson-ci.org/downloads/plugins/build-timeout/1.6/build-timeout.h # Configure plugins for plugin in ${PLUGINS//,/ }; do - name=`basename $plugin` + name=`basename $plugin` dest=/var/lib/jenkins/plugins/$name if [ ! -e $dest ]; then curl -L $plugin -o $dest diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh index 0f314bfa9a..9a2f5a8c03 100755 --- a/tools/xen/install_os_domU.sh +++ b/tools/xen/install_os_domU.sh @@ -44,9 +44,9 @@ source $THIS_DIR/xenrc xe_min() { - local cmd="$1" - shift - xe "$cmd" --minimal "$@" + local cmd="$1" + shift + xe "$cmd" --minimal "$@" } # @@ -132,8 +132,8 @@ HOST_IP=$(xenapi_ip_on "$MGT_BRIDGE_OR_NET_NAME") # Set up ip forwarding, but skip on xcp-xapi if [ -a /etc/sysconfig/network ]; then if ! grep -q "FORWARD_IPV4=YES" /etc/sysconfig/network; then - # FIXME: This doesn't work on reboot! - echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network + # FIXME: This doesn't work on reboot! + echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network fi fi # Also, enable ip forwarding in rc.local, since the above trick isn't working diff --git a/tools/xen/scripts/install-os-vpx.sh b/tools/xen/scripts/install-os-vpx.sh index 7469e0c10b..7b0d891493 100755 --- a/tools/xen/scripts/install-os-vpx.sh +++ b/tools/xen/scripts/install-os-vpx.sh @@ -42,69 +42,69 @@ EOF get_params() { - while getopts "hbn:r:l:t:" OPTION; - do - case $OPTION in - h) usage - exit 1 - ;; - n) - BRIDGE=$OPTARG - ;; - l) - NAME_LABEL=$OPTARG - ;; - t) - TEMPLATE_NAME=$OPTARG - ;; - ?) - usage - exit - ;; - esac - done - if [[ -z $BRIDGE ]] - then - BRIDGE=xenbr0 - fi + while getopts "hbn:r:l:t:" OPTION; + do + case $OPTION in + h) usage + exit 1 + ;; + n) + BRIDGE=$OPTARG + ;; + l) + NAME_LABEL=$OPTARG + ;; + t) + TEMPLATE_NAME=$OPTARG + ;; + ?) + usage + exit + ;; + esac + done + if [[ -z $BRIDGE ]] + then + BRIDGE=xenbr0 + fi - if [[ -z $TEMPLATE_NAME ]]; then - echo "Please specify a template name" >&2 - exit 1 - fi + if [[ -z $TEMPLATE_NAME ]]; then + echo "Please specify a template name" >&2 + exit 1 + fi - if [[ -z $NAME_LABEL ]]; then - echo "Please specify a name-label for the new VM" >&2 - exit 1 - fi + if [[ -z $NAME_LABEL ]]; then + echo "Please specify a name-label for the new VM" >&2 + exit 1 + fi } xe_min() { - local cmd="$1" - shift - xe "$cmd" --minimal "$@" + local cmd="$1" + shift + xe "$cmd" --minimal "$@" } find_network() { - result=$(xe_min network-list bridge="$1") - if [ "$result" = "" ] - then - result=$(xe_min network-list name-label="$1") - fi - echo "$result" + result=$(xe_min network-list bridge="$1") + if [ "$result" = "" ] + then + result=$(xe_min network-list name-label="$1") + fi + echo "$result" } create_vif() { - local v="$1" - echo "Installing VM interface on [$BRIDGE]" - local out_network_uuid=$(find_network "$BRIDGE") - xe vif-create vm-uuid="$v" network-uuid="$out_network_uuid" device="0" + local v="$1" + echo "Installing VM interface on [$BRIDGE]" + local out_network_uuid=$(find_network "$BRIDGE") + xe vif-create vm-uuid="$v" network-uuid="$out_network_uuid" device="0" } @@ -112,20 +112,20 @@ create_vif() # Make the VM auto-start on server boot. set_auto_start() { - local v="$1" - xe vm-param-set uuid="$v" other-config:auto_poweron=true + local v="$1" + xe vm-param-set uuid="$v" other-config:auto_poweron=true } destroy_vifs() { - local v="$1" - IFS=, - for vif in $(xe_min vif-list vm-uuid="$v") - do - xe vif-destroy uuid="$vif" - done - unset IFS + local v="$1" + IFS=, + for vif in $(xe_min vif-list vm-uuid="$v") + do + xe vif-destroy uuid="$vif" + done + unset IFS } diff --git a/tools/xen/scripts/uninstall-os-vpx.sh b/tools/xen/scripts/uninstall-os-vpx.sh index ac260949c4..1ed249433a 100755 --- a/tools/xen/scripts/uninstall-os-vpx.sh +++ b/tools/xen/scripts/uninstall-os-vpx.sh @@ -22,63 +22,63 @@ set -ex # By default, don't remove the templates REMOVE_TEMPLATES=${REMOVE_TEMPLATES:-"false"} if [ "$1" = "--remove-templates" ]; then - REMOVE_TEMPLATES=true + REMOVE_TEMPLATES=true fi xe_min() { - local cmd="$1" - shift - xe "$cmd" --minimal "$@" + local cmd="$1" + shift + xe "$cmd" --minimal "$@" } destroy_vdi() { - local vbd_uuid="$1" - local type=$(xe_min vbd-list uuid=$vbd_uuid params=type) - local dev=$(xe_min vbd-list uuid=$vbd_uuid params=userdevice) - local vdi_uuid=$(xe_min vbd-list uuid=$vbd_uuid params=vdi-uuid) + local vbd_uuid="$1" + local type=$(xe_min vbd-list uuid=$vbd_uuid params=type) + local dev=$(xe_min vbd-list uuid=$vbd_uuid params=userdevice) + local vdi_uuid=$(xe_min vbd-list uuid=$vbd_uuid params=vdi-uuid) - if [ "$type" == 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ]; then - xe vdi-destroy uuid=$vdi_uuid - fi + if [ "$type" == 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ]; then + xe vdi-destroy uuid=$vdi_uuid + fi } uninstall() { - local vm_uuid="$1" - local power_state=$(xe_min vm-list uuid=$vm_uuid params=power-state) + local vm_uuid="$1" + local power_state=$(xe_min vm-list uuid=$vm_uuid params=power-state) - if [ "$power_state" != "halted" ]; then - xe vm-shutdown vm=$vm_uuid force=true - fi + if [ "$power_state" != "halted" ]; then + xe vm-shutdown vm=$vm_uuid force=true + fi - for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do - destroy_vdi "$v" - done + for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do + destroy_vdi "$v" + done - xe vm-uninstall vm=$vm_uuid force=true >/dev/null + xe vm-uninstall vm=$vm_uuid force=true >/dev/null } uninstall_template() { - local vm_uuid="$1" + local vm_uuid="$1" - for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do - destroy_vdi "$v" - done + for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do + destroy_vdi "$v" + done - xe template-uninstall template-uuid=$vm_uuid force=true >/dev/null + xe template-uninstall template-uuid=$vm_uuid force=true >/dev/null } # remove the VMs and their disks for u in $(xe_min vm-list other-config:os-vpx=true | sed -e 's/,/ /g'); do - uninstall "$u" + uninstall "$u" done # remove the templates if [ "$REMOVE_TEMPLATES" == "true" ]; then - for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g'); do - uninstall_template "$u" - done + for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g'); do + uninstall_template "$u" + done fi