final bash8 files for the rest of devstack

With this devstack/master is bash8 clean, and ready for enforcement

Change-Id: I03fc89b401e6b7a23224d71472122c1bfa3ad0bd
This commit is contained in:
Sean Dague 2013-10-22 11:37:35 -04:00
parent 02d7fe13bb
commit 0b865a55f2
7 changed files with 106 additions and 106 deletions

View File

@ -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

View File

@ -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 &

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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