Fix bashate errors

- Excluding awk and python scripts.
- The Bashate E012 rule ('heredoc did not end before EOF') could be simply
  ignored until the bashate bug will be fixed.

Change-Id: Id72665aba83df753364940c82db08edcb11e1217
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2015-03-06 21:11:48 +01:00
parent f219a1af96
commit 64b94692a5
43 changed files with 579 additions and 482 deletions

5
run-bashate.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash -
# We could ignore the E012 bashate rule until the bug will be fixed in it.
find scripts -type f -not -name '*.awk' -print0 | xargs -0 grep -HL '^#!/usr/bin/env python' | xargs bashate -v -i E012

View File

@ -20,7 +20,7 @@ set -eu
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] LISTFILE"
echo
echo "Ensure that every user listed in LISTFILE has an admin account."
@ -34,7 +34,10 @@ function show_options () {
}
TEMP=`getopt -o h -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

View File

@ -20,7 +20,7 @@ set -eu
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options]"
echo
echo "Ensure that a given user exists."
@ -41,7 +41,10 @@ TENANT=''
USERCODE=''
TEMP=`getopt -o hu:e:n:t: -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -77,8 +80,8 @@ if [ -z "$USER_ID" ]; then
echo "$USERCODE $PASSWORD" >> os-asserted-users
fi
USER_ID=$(keystone user-create --name=$USERCODE \
--pass="$PASSWORD" \
--email="$EMAIL" | awk '$2=="id" {print $4}')
--pass="$PASSWORD" \
--email="$EMAIL" | awk '$2=="id" {print $4}')
fi
#TODO: fix after bug 1392035 in keystone client
TENANT_ID=$(keystone tenant-list | awk '{print tolower($0)}' |grep " ${TENANT,,} " |awk '{print$2}')

View File

@ -20,7 +20,7 @@ set -eu
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] LISTFILE"
echo
echo "Ensure that every user listed in LISTFILE has a cloud account."
@ -35,7 +35,10 @@ function show_options () {
TENANT=''
TEMP=`getopt -o ht: -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -58,9 +61,9 @@ fi
while IFS=, read -ra DETAILS; do
if [ -z "$TENANT" ] ; then
USER_TENANT=${DETAILS[0]}
USER_TENANT=${DETAILS[0]}
else
USER_TENANT=$TENANT
USER_TENANT=$TENANT
fi
assert-user -u ${DETAILS[0]} -e ${DETAILS[1]} -t $USER_TENANT -n "${DETAILS[2]}"
done < $LISTFILE

View File

@ -47,7 +47,7 @@ if [[ "$DIB_COMMON_ELEMENTS $SEED_DIB_EXTRA_ARGS" != *enable-serial-console* ]];
fi
export VM_IP=""
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] <element> [<element> ...]"
echo
echo "Create and start a VM by combining the specified elements"
@ -82,7 +82,10 @@ function show_options () {
}
TEMP=$(getopt -o hcia:o:s: -l build-only -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -101,7 +104,9 @@ while true ; do
esac
done
for arg do SEED_DIB_EXTRA_ARGS="$SEED_DIB_EXTRA_ARGS $arg" ; done
for arg; do
SEED_DIB_EXTRA_ARGS="$SEED_DIB_EXTRA_ARGS $arg";
done
SEED_ARCH=
@ -119,12 +124,12 @@ fi
HOST_IP=$(os-apply-config -m $TE_DATAFILE --key host-ip --type netaddress --key-default '')
REMOTE_OPERATIONS=$(os-apply-config -m $TE_DATAFILE --key remote-operations --type raw --key-default '')
if [ -n "$HOST_IP" ]; then
SSH_USER=$(os-apply-config -m $TE_DATAFILE --key ssh-user --type raw --key-default '')
if [ -n "$SSH_USER" ]; then
SSH_USER="${SSH_USER}@"
fi
VM_HOST=${SSH_USER}${HOST_IP}
echo $VM_HOST
SSH_USER=$(os-apply-config -m $TE_DATAFILE --key ssh-user --type raw --key-default '')
if [ -n "$SSH_USER" ]; then
SSH_USER="${SSH_USER}@"
fi
VM_HOST=${SSH_USER}${HOST_IP}
echo $VM_HOST
fi
ENV_NUM=$(os-apply-config -m $TE_DATAFILE --key env-num --type int --key-default 0)
@ -147,18 +152,18 @@ fi
# Shutdown any running VM - writing to the image file of a running VM is a
# great way to get a corrupt image file.
if [ -z "$BUILD_ONLY" ]; then
if [ -n "$REMOTE_OPERATIONS" ]; then
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${VM_HOST} virsh destroy ${IMAGE_NAME}_$ENV_NUM || true
# Ensure any existing VM's in the test environment are shutdown, so devtest always starts at a consistent point.
for NUM in $(seq 0 14) ; do
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${VM_HOST} virsh destroy baremetalbrbm${ENV_NUM}_${NUM} || true
done
else
virsh destroy $IMAGE_NAME || true
for NUM in $(seq 0 14) ; do
virsh destroy baremetal_${NUM} || true
done
fi
if [ -n "$REMOTE_OPERATIONS" ]; then
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${VM_HOST} virsh destroy ${IMAGE_NAME}_$ENV_NUM || true
# Ensure any existing VM's in the test environment are shutdown, so devtest always starts at a consistent point.
for NUM in $(seq 0 14) ; do
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${VM_HOST} virsh destroy baremetalbrbm${ENV_NUM}_${NUM} || true
done
else
virsh destroy $IMAGE_NAME || true
for NUM in $(seq 0 14) ; do
virsh destroy baremetal_${NUM} || true
done
fi
fi
if [ $CREATE_IMAGE ]; then
@ -172,37 +177,37 @@ if [ $CREATE_IMAGE ]; then
echo "Using cached seed image : $IMAGE_CACHE_FILE.qcow2"
fi
if [ -n "$BUILD_ONLY" ]; then
exit 0
exit 0
fi
if [ -n "$REMOTE_OPERATIONS" ]; then
# rsync could be used here which may have been more efficient but using a
# custom command "copyseed" should be easier to restrict. Also we can
# take multiple steps on the server in this single command meaning we
# don't have to open up the ssh access even further.
dd if=$IMAGE_CACHE_FILE.qcow2 | ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${VM_HOST} copyseed $ENV_NUM
# rsync could be used here which may have been more efficient but using a
# custom command "copyseed" should be easier to restrict. Also we can
# take multiple steps on the server in this single command meaning we
# don't have to open up the ssh access even further.
dd if=$IMAGE_CACHE_FILE.qcow2 | ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${VM_HOST} copyseed $ENV_NUM
else
sudo cp $IMAGE_CACHE_FILE.qcow2 /var/lib/libvirt/images/$IMAGE_NAME.qcow2
sudo chattr +C /var/lib/libvirt/images/$IMAGE_NAME.qcow2 || true
sudo cp $IMAGE_CACHE_FILE.qcow2 /var/lib/libvirt/images/$IMAGE_NAME.qcow2
sudo chattr +C /var/lib/libvirt/images/$IMAGE_NAME.qcow2 || true
fi
fi
function poll_vm {
if [ -z "$VM_IP" ]; then
MAC=$(sudo virsh dumpxml $IMAGE_NAME | grep "mac address" | head -1 | awk -F "'" '{print $2}')
VM_IP=$(arp -n | grep $MAC | awk '{print $1}')
fi
[ -z $VM_IP ] && return 1
ping -c 1 $VM_IP || return 1
return 0
if [ -z "$VM_IP" ]; then
MAC=$(sudo virsh dumpxml $IMAGE_NAME | grep "mac address" | head -1 | awk -F "'" '{print $2}')
VM_IP=$(arp -n | grep $MAC | awk '{print $1}')
fi
[ -z $VM_IP ] && return 1
ping -c 1 $VM_IP || return 1
return 0
}
export -f poll_vm
if [ -n "$REMOTE_OPERATIONS" ]; then
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${VM_HOST} virsh start ${IMAGE_NAME}_$ENV_NUM
VM_IP=$(os-apply-config -m $TE_DATAFILE --key seed-ip --type netaddress --key-default '')
ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no ${VM_HOST} virsh start ${IMAGE_NAME}_$ENV_NUM
VM_IP=$(os-apply-config -m $TE_DATAFILE --key seed-ip --type netaddress --key-default '')
else
sudo virsh start $IMAGE_NAME
sudo virsh start $IMAGE_NAME
fi
echo "Waiting for $IMAGE_NAME VM to boot."

View File

@ -19,7 +19,7 @@ SCRIPT_NAME=$(basename $0)
LIBVIRT_VOL_POOL=${LIBVIRT_VOL_POOL:-"default"}
function show_options() {
function show_options {
echo "Usage: $SCRIPT_NAME [-n NUM]"
echo
echo "Cleanup vm state left behind by previous runs"
@ -34,26 +34,28 @@ function show_options() {
NUM=
TEMP=$(getopt -o h,n: -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then show_options; fi
if [ $? != 0 ]; then
show_options;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
while true ; do
case "$1" in
-h) show_options ;;
-n) NUM="$2" ; shift 2 ;;
--) shift ; break ;;
*) echo "Error: unsupported option $1." ; show_options ;;
esac
case "$1" in
-h) show_options ;;
-n) NUM="$2" ; shift 2 ;;
--) shift ; break ;;
*) echo "Error: unsupported option $1." ; show_options ;;
esac
done
SEED_NAME=seed
BRIDGE_NAME=
if [ -n "$NUM" ]; then
SEED_NAME="seed_${NUM}"
BRIDGE_NAME="brbm${NUM}"
SEED_NAME="seed_${NUM}"
BRIDGE_NAME="brbm${NUM}"
fi
BAREMETAL_REGEX="baremetal${BRIDGE_NAME}"
@ -73,5 +75,5 @@ for NAME in $(sudo virsh list --name --all | grep "^\($SEED_NAME\|${BAREMETAL_RE
done
for NAME in $(sudo virsh vol-list $LIBVIRT_VOL_POOL 2>/dev/null | grep /var/ | awk '{print $1}' | grep "^\($SEED_NAME\|$BAREMETAL_REGEX\)" ); do
sudo virsh vol-delete --pool $LIBVIRT_VOL_POOL $NAME
sudo virsh vol-delete --pool $LIBVIRT_VOL_POOL $NAME
done

View File

@ -26,12 +26,13 @@ LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"virtio"}
LIBVIRT_VOL_POOL=${LIBVIRT_VOL_POOL:-"default"}
# define the default storage pool if its not there yet
(virsh pool-list --all --persistent | grep -q $LIBVIRT_VOL_POOL) || (
virsh pool-define-as --name $LIBVIRT_VOL_POOL dir --target /var/lib/libvirt/images; virsh pool-autostart $LIBVIRT_VOL_POOL; virsh pool-start $LIBVIRT_VOL_POOL) >&2
(virsh pool-list --all --persistent | grep -q $LIBVIRT_VOL_POOL) || \
(virsh pool-define-as --name $LIBVIRT_VOL_POOL dir --target /var/lib/libvirt/images; \
virsh pool-autostart $LIBVIRT_VOL_POOL; virsh pool-start $LIBVIRT_VOL_POOL) >&2
PREALLOC=
if [ "${TRIPLEO_OS_FAMILY:-}" = "debian" ]; then
PREALLOC="--prealloc-metadata"
PREALLOC="--prealloc-metadata"
fi
# Create empty json file if it doesn't exist
@ -44,28 +45,28 @@ if [[ ${DIB_COMMON_ELEMENTS:-} == *enable-serial-console* ]]; then
fi
for idx in $(seq 0 $TOTAL) ; do
vm_name="baremetal${BRIDGE}_$idx"
(virsh list --all --name | grep -q "^$vm_name\$") && continue
virsh vol-create-as $LIBVIRT_VOL_POOL $vm_name.qcow2 ${NODE_DISK}G --format qcow2 $PREALLOC >&2
volume_path=$(virsh vol-path --pool $LIBVIRT_VOL_POOL $vm_name.qcow2)
# Pre-touch the VM to set +C, as it can only be set on empty files.
sudo touch "$volume_path"
sudo chattr +C "$volume_path" || true
BAREMETAL_INTERFACE=
if [ -n "$BRIDGE" ]; then
BAREMETAL_INTERFACE="--baremetal-interface $BRIDGE"
fi
configure-vm $EXTRAOPTS \
--bootdev network \
--name $vm_name \
--image "$volume_path" \
--diskbus $LIBVIRT_DISK_BUS_TYPE \
--arch $ARCH \
--cpus $CPU \
--memory $MEM \
--libvirt-nic-driver $LIBVIRT_NIC_DRIVER $BAREMETAL_INTERFACE >&2
mac=$(get-vm-mac $vm_name)
JSON=$(jq ".nodes=(.nodes + [{mac:[\"$mac\"], cpu:\"$CPU\", memory:\"$2\", disk:\"$DISK\", arch:\"$4\", pm_user:\"$SSH_USER\", pm_addr:\"$HOSTIP\", pm_password:.[\"ssh-key\"], pm_type:\"pxe_ssh\"}])" <<< $JSON)
vm_name="baremetal${BRIDGE}_$idx"
(virsh list --all --name | grep -q "^$vm_name\$") && continue
virsh vol-create-as $LIBVIRT_VOL_POOL $vm_name.qcow2 ${NODE_DISK}G --format qcow2 $PREALLOC >&2
volume_path=$(virsh vol-path --pool $LIBVIRT_VOL_POOL $vm_name.qcow2)
# Pre-touch the VM to set +C, as it can only be set on empty files.
sudo touch "$volume_path"
sudo chattr +C "$volume_path" || true
BAREMETAL_INTERFACE=
if [ -n "$BRIDGE" ]; then
BAREMETAL_INTERFACE="--baremetal-interface $BRIDGE"
fi
configure-vm $EXTRAOPTS \
--bootdev network \
--name $vm_name \
--image "$volume_path" \
--diskbus $LIBVIRT_DISK_BUS_TYPE \
--arch $ARCH \
--cpus $CPU \
--memory $MEM \
--libvirt-nic-driver $LIBVIRT_NIC_DRIVER $BAREMETAL_INTERFACE >&2
mac=$(get-vm-mac $vm_name)
JSON=$(jq ".nodes=(.nodes + [{mac:[\"$mac\"], cpu:\"$CPU\", memory:\"$2\", disk:\"$DISK\", arch:\"$4\", pm_user:\"$SSH_USER\", pm_addr:\"$HOSTIP\", pm_password:.[\"ssh-key\"], pm_type:\"pxe_ssh\"}])" <<< $JSON)
done
jq . <<< $JSON > $TE_DATAFILE

View File

@ -15,7 +15,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options]"
echo
echo "Test the core TripleO story."
@ -69,7 +69,10 @@ export TRIPLEO_CLEANUP=1
DEVTEST_START=$(date +%s) #nodocs
TEMP=$(getopt -o h,c -l build-only,no-mergepy,debug-logging,existing-environment,help,trash-my-machine,nodes:,bm-networks:,no-undercloud,heat-env-overcloud:,heat-env-undercloud: -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -307,9 +310,9 @@ DEVTEST_RD_END=$(date +%s) #nodocs
### --end
DEVTEST_SD_START=$(date +%s)
if [ -z "$NO_UNDERCLOUD" ]; then
ALLNODES=""
ALLNODES=""
else
ALLNODES="--all-nodes"
ALLNODES="--all-nodes"
fi
devtest_seed.sh $BUILD_ONLY $ALLNODES $DEBUG_LOGGING
DEVTEST_SD_END=$(date +%s)
@ -377,3 +380,4 @@ echo "${TIMESTAMP} seed : $((DEVTEST_SD_END - DEVTEST_SD_START)) s" | te
echo "${TIMESTAMP} undercloud : $((DEVTEST_UC_END - DEVTEST_UC_START)) s" | tee -a ${DEVTEST_PERF_LOG} #nodocs
echo "${TIMESTAMP} overcloud : $((DEVTEST_OC_END - DEVTEST_OC_START)) s" | tee -a ${DEVTEST_PERF_LOG} #nodocs
echo "${TIMESTAMP} DIB_COMMON_ELEMENTS=${DIB_COMMON_ELEMENTS}" >> ${DEVTEST_PERF_LOG} #nodocs

View File

@ -13,10 +13,10 @@ set -o pipefail
### --end
if [ -e tripleorc ]; then
echo "Resetting existing $PWD/tripleorc with new values"
tripleorc_path=$PWD/tripleorc
echo "Resetting existing $PWD/tripleorc with new values"
tripleorc_path=$PWD/tripleorc
else
tripleorc_path=$TRIPLEO_ROOT/tripleorc
tripleorc_path=$TRIPLEO_ROOT/tripleorc
fi
write-tripleorc --overwrite $tripleorc_path

View File

@ -14,7 +14,7 @@ CONTROL_FLAVOR="baremetal"
BLOCKSTORAGE_FLAVOR="baremetal"
SWIFTSTORAGE_FLAVOR="baremetal"
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options]"
echo
echo "Deploys a KVM cloud via heat."
@ -43,7 +43,10 @@ function show_options () {
}
TEMP=$(getopt -o c,h -l build-only,no-mergepy,debug-logging,heat-env:,compute-flavor:,control-flavor:,block-storage-flavor:,swift-storage-flavor:,help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ] ; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -197,19 +200,19 @@ fi
OVERCLOUD_DISTRIBUTED_ROUTERS=${OVERCLOUD_DISTRIBUTED_ROUTERS:-'False'}
if [ $OVERCLOUD_DISTRIBUTED_ROUTERS == "True" ]; then
ComputeNeutronRole=' neutron-router'
OVERCLOUD_COMPUTE_DIB_ELEMENTS=$OVERCLOUD_COMPUTE_DIB_ELEMENTS$ComputeNeutronRole
ComputeNeutronRole=' neutron-router'
OVERCLOUD_COMPUTE_DIB_ELEMENTS=$OVERCLOUD_COMPUTE_DIB_ELEMENTS$ComputeNeutronRole
fi
## #. Create your overcloud compute image. This is the image the undercloud
## deploys to host KVM (or QEMU, Xen, etc.) instances.
## ::
if [ ! -e $TRIPLEO_ROOT/overcloud-compute.qcow2 -o "$USE_CACHE" == "0" ] ; then #nodocs
if [ ! -e $TRIPLEO_ROOT/overcloud-compute.qcow2 -o "$USE_CACHE" == "0" ]; then #nodocs
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
-a $NODE_ARCH -o $TRIPLEO_ROOT/overcloud-compute \
$OVERCLOUD_COMPUTE_DIB_ELEMENTS $DIB_COMMON_ELEMENTS \
$OVERCLOUD_COMPUTE_DIB_EXTRA_ARGS 2>&1 | \
$OVERCLOUD_COMPUTE_DIB_ELEMENTS $DIB_COMMON_ELEMENTS \
$OVERCLOUD_COMPUTE_DIB_EXTRA_ARGS 2>&1 | \
tee $TRIPLEO_ROOT/dib-overcloud-compute.log
fi #nodocs
@ -219,7 +222,7 @@ fi #nodocs
### --end
if [ -n "$BUILD_ONLY" ]; then
exit 0
exit 0
fi
### --include
@ -260,19 +263,19 @@ NeutronAgentMode='dvr_snat'
NeutronComputeAgentMode='dvr'
NeutronAllowl3AgentFailover=${NeutronAllowl3AgentFailover:-'True'}
if [ $OVERCLOUD_DISTRIBUTED_ROUTERS == "True" ]; then
NeutronMechanismDrivers='openvswitch,l2population'
NeutronTunnelTypes='vxlan'
NeutronNetworkType='vxlan'
NeutronDVR='True'
OVERCLOUD_HYPERVISOR_PHYSICAL_BRIDGE=${NeutronPhysicalBridge:-'br-ex'}
OVERCLOUD_HYPERVISOR_PUBLIC_INTERFACE=${NeutronPublicInterface:-''}
NeutronAllowL3AgentFailover='False'
NeutronMechanismDrivers='openvswitch,l2population'
NeutronTunnelTypes='vxlan'
NeutronNetworkType='vxlan'
NeutronDVR='True'
OVERCLOUD_HYPERVISOR_PHYSICAL_BRIDGE=${NeutronPhysicalBridge:-'br-ex'}
OVERCLOUD_HYPERVISOR_PUBLIC_INTERFACE=${NeutronPublicInterface:-''}
NeutronAllowL3AgentFailover='False'
else
NeutronMechanismDrivers=${NeutronMechanismDrivers:-'openvswitch'}
NeutronTunnelTypes=${NeutronTunnelTypes:-'gre'}
NeutronNetworkType=${NeutronNetworkTypes:-'gre'}
NeutronDVR='False'
NeutronAllowL3AgentFailover='True'
NeutronMechanismDrivers=${NeutronMechanismDrivers:-'openvswitch'}
NeutronTunnelTypes=${NeutronTunnelTypes:-'gre'}
NeutronNetworkType=${NeutronNetworkTypes:-'gre'}
NeutronDVR='False'
NeutronAllowL3AgentFailover='True'
fi
## #. If you are using SSL, your compute nodes will need static mappings to your
@ -349,14 +352,14 @@ UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD=$(os-apply-config -m $TE_DATAFILE --key und
#
# If we can't find the file in $CWD we look in the new default location.
if [ -e tripleo-overcloud-passwords ]; then
echo "Re-using existing passwords in $PWD/tripleo-overcloud-passwords"
# Add any new passwords since the file was generated
setup-overcloud-passwords tripleo-overcloud-passwords
source tripleo-overcloud-passwords
echo "Re-using existing passwords in $PWD/tripleo-overcloud-passwords"
# Add any new passwords since the file was generated
setup-overcloud-passwords tripleo-overcloud-passwords
source tripleo-overcloud-passwords
else
### --include
setup-overcloud-passwords $TRIPLEO_ROOT/tripleo-overcloud-passwords
source $TRIPLEO_ROOT/tripleo-overcloud-passwords
setup-overcloud-passwords $TRIPLEO_ROOT/tripleo-overcloud-passwords
source $TRIPLEO_ROOT/tripleo-overcloud-passwords
fi #nodocs
## #. We need an environment file to store the parameters we're gonig to give
@ -384,52 +387,52 @@ fi
NeutronControlPlaneID=$(neutron net-show ctlplane | grep ' id ' | awk '{print $4}')
ENV_JSON=$(jq '.parameters = {
"MysqlInnodbBufferPoolSize": 100
} + .parameters + {
"AdminPassword": "'"${OVERCLOUD_ADMIN_PASSWORD}"'",
"AdminToken": "'"${OVERCLOUD_ADMIN_TOKEN}"'",
"CeilometerPassword": "'"${OVERCLOUD_CEILOMETER_PASSWORD}"'",
"CeilometerMeteringSecret": "'"${OVERCLOUD_CEILOMETER_SECRET}"'",
"CinderPassword": "'"${OVERCLOUD_CINDER_PASSWORD}"'",
"CloudName": "'"${OVERCLOUD_NAME}"'",
"controllerImage": "'"${OVERCLOUD_CONTROL_ID}"'",
"GlancePassword": "'"${OVERCLOUD_GLANCE_PASSWORD}"'",
"HeatPassword": "'"${OVERCLOUD_HEAT_PASSWORD}"'",
"HeatStackDomainAdminPassword": "'"${OVERCLOUD_HEAT_STACK_DOMAIN_PASSWORD}"'",
"HypervisorNeutronPhysicalBridge": "'"${OVERCLOUD_HYPERVISOR_PHYSICAL_BRIDGE}"'",
"HypervisorNeutronPublicInterface": "'"${OVERCLOUD_HYPERVISOR_PUBLIC_INTERFACE}"'",
"NeutronBridgeMappings": "'"${OVERCLOUD_BRIDGE_MAPPINGS}"'",
"NeutronControlPlaneID": "'${NeutronControlPlaneID}'",
"NeutronFlatNetworks": "'"${OVERCLOUD_FLAT_NETWORKS}"'",
"NeutronPassword": "'"${OVERCLOUD_NEUTRON_PASSWORD}"'",
"NeutronPublicInterface": "'"${NeutronPublicInterface}"'",
"NeutronPublicInterfaceTag": "'"${NeutronPublicInterfaceTag}"'",
"NovaComputeLibvirtType": "'"${OVERCLOUD_LIBVIRT_TYPE}"'",
"NovaPassword": "'"${OVERCLOUD_NOVA_PASSWORD}"'",
"NtpServer": "'"${OVERCLOUD_NTP_SERVER}"'",
"SwiftHashSuffix": "'"${OVERCLOUD_SWIFT_HASH}"'",
"SwiftPassword": "'"${OVERCLOUD_SWIFT_PASSWORD}"'",
"NovaImage": "'"${OVERCLOUD_COMPUTE_ID}"'",
"SSLCertificate": "'"${OVERCLOUD_SSL_CERT}"'",
"SSLKey": "'"${OVERCLOUD_SSL_KEY}"'",
"OvercloudComputeFlavor": "'"${COMPUTE_FLAVOR}"'",
"OvercloudControlFlavor": "'"${CONTROL_FLAVOR}"'",
"OvercloudBlockStorageFlavor": "'"${BLOCKSTORAGE_FLAVOR}"'",
"OvercloudSwiftStorageFlavor": "'"${SWIFTSTORAGE_FLAVOR}"'"
}' <<< $ENV_JSON)
"MysqlInnodbBufferPoolSize": 100
} + .parameters + {
"AdminPassword": "'"${OVERCLOUD_ADMIN_PASSWORD}"'",
"AdminToken": "'"${OVERCLOUD_ADMIN_TOKEN}"'",
"CeilometerPassword": "'"${OVERCLOUD_CEILOMETER_PASSWORD}"'",
"CeilometerMeteringSecret": "'"${OVERCLOUD_CEILOMETER_SECRET}"'",
"CinderPassword": "'"${OVERCLOUD_CINDER_PASSWORD}"'",
"CloudName": "'"${OVERCLOUD_NAME}"'",
"controllerImage": "'"${OVERCLOUD_CONTROL_ID}"'",
"GlancePassword": "'"${OVERCLOUD_GLANCE_PASSWORD}"'",
"HeatPassword": "'"${OVERCLOUD_HEAT_PASSWORD}"'",
"HeatStackDomainAdminPassword": "'"${OVERCLOUD_HEAT_STACK_DOMAIN_PASSWORD}"'",
"HypervisorNeutronPhysicalBridge": "'"${OVERCLOUD_HYPERVISOR_PHYSICAL_BRIDGE}"'",
"HypervisorNeutronPublicInterface": "'"${OVERCLOUD_HYPERVISOR_PUBLIC_INTERFACE}"'",
"NeutronBridgeMappings": "'"${OVERCLOUD_BRIDGE_MAPPINGS}"'",
"NeutronControlPlaneID": "'${NeutronControlPlaneID}'",
"NeutronFlatNetworks": "'"${OVERCLOUD_FLAT_NETWORKS}"'",
"NeutronPassword": "'"${OVERCLOUD_NEUTRON_PASSWORD}"'",
"NeutronPublicInterface": "'"${NeutronPublicInterface}"'",
"NeutronPublicInterfaceTag": "'"${NeutronPublicInterfaceTag}"'",
"NovaComputeLibvirtType": "'"${OVERCLOUD_LIBVIRT_TYPE}"'",
"NovaPassword": "'"${OVERCLOUD_NOVA_PASSWORD}"'",
"NtpServer": "'"${OVERCLOUD_NTP_SERVER}"'",
"SwiftHashSuffix": "'"${OVERCLOUD_SWIFT_HASH}"'",
"SwiftPassword": "'"${OVERCLOUD_SWIFT_PASSWORD}"'",
"NovaImage": "'"${OVERCLOUD_COMPUTE_ID}"'",
"SSLCertificate": "'"${OVERCLOUD_SSL_CERT}"'",
"SSLKey": "'"${OVERCLOUD_SSL_KEY}"'",
"OvercloudComputeFlavor": "'"${COMPUTE_FLAVOR}"'",
"OvercloudControlFlavor": "'"${CONTROL_FLAVOR}"'",
"OvercloudBlockStorageFlavor": "'"${BLOCKSTORAGE_FLAVOR}"'",
"OvercloudSwiftStorageFlavor": "'"${SWIFTSTORAGE_FLAVOR}"'"
}' <<< $ENV_JSON)
### --end
if [ "$DEBUG_LOGGING" = "1" ]; then
ENV_JSON=$(jq '.parameters = .parameters + {
"Debug": "True",
}' <<< $ENV_JSON)
"Debug": "True",
}' <<< $ENV_JSON)
fi
### --include
if [ $OVERCLOUD_BLOCKSTORAGESCALE -gt 0 ]; then
ENV_JSON=$(jq '.parameters = {} + .parameters + {
"BlockStorageImage": "'"${OVERCLOUD_BLOCKSTORAGE_ID}"'",
}' <<< $ENV_JSON)
"BlockStorageImage": "'"${OVERCLOUD_BLOCKSTORAGE_ID}"'",
}' <<< $ENV_JSON)
fi
if [ $OVERCLOUD_DISTRIBUTED_ROUTERS == "True" ]; then
@ -447,13 +450,13 @@ fi
### --end
# Options we haven't documented as such
ENV_JSON=$(jq '.parameters = {
"ControlVirtualInterface": "'${OVERCLOUD_VIRTUAL_INTERFACE}'"
} + .parameters + {
"NeutronPublicInterfaceDefaultRoute": "'${NeutronPublicInterfaceDefaultRoute}'",
"NeutronPublicInterfaceIP": "'${NeutronPublicInterfaceIP}'",
"NeutronPublicInterfaceRawDevice": "'${NeutronPublicInterfaceRawDevice}'",
"SnmpdReadonlyUserPassword": "'${UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD}'",
}' <<< $ENV_JSON)
"ControlVirtualInterface": "'${OVERCLOUD_VIRTUAL_INTERFACE}'"
} + .parameters + {
"NeutronPublicInterfaceDefaultRoute": "'${NeutronPublicInterfaceDefaultRoute}'",
"NeutronPublicInterfaceIP": "'${NeutronPublicInterfaceIP}'",
"NeutronPublicInterfaceRawDevice": "'${NeutronPublicInterfaceRawDevice}'",
"SnmpdReadonlyUserPassword": "'${UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD}'",
}' <<< $ENV_JSON)
RESOURCE_REGISTRY=
RESOURCE_REGISTRY_PATH=${RESOURCE_REGISTRY_PATH:-"$TRIPLEO_ROOT/tripleo-heat-templates/overcloud-resource-registry.yaml"}
@ -461,13 +464,13 @@ RESOURCE_REGISTRY_PATH=${RESOURCE_REGISTRY_PATH:-"$TRIPLEO_ROOT/tripleo-heat-tem
if [ "$USE_MERGEPY" -eq 0 ]; then
RESOURCE_REGISTRY="-e $RESOURCE_REGISTRY_PATH"
ENV_JSON=$(jq '.parameters = .parameters + {
"ControllerCount": '${OVERCLOUD_CONTROLSCALE}',
"ComputeCount": '${OVERCLOUD_COMPUTESCALE}'
}' <<< $ENV_JSON)
"ControllerCount": '${OVERCLOUD_CONTROLSCALE}',
"ComputeCount": '${OVERCLOUD_COMPUTESCALE}'
}' <<< $ENV_JSON)
if [ -e "$TRIPLEO_ROOT/tripleo-heat-templates/cinder-storage.yaml" ]; then
ENV_JSON=$(jq '.parameters = .parameters + {
"BlockStorageCount": '${OVERCLOUD_BLOCKSTORAGESCALE}'
}' <<< $ENV_JSON)
"BlockStorageCount": '${OVERCLOUD_BLOCKSTORAGESCALE}'
}' <<< $ENV_JSON)
fi
fi

View File

@ -5,7 +5,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options]"
echo
echo "Build a baremetal deployment ramdisk."
@ -17,7 +17,10 @@ function show_options () {
}
TEMP=$(getopt -o h -l help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -49,8 +52,8 @@ DIB_COMMON_ELEMENTS=${DIB_COMMON_ELEMENTS:-'stackuser'}
### --end
NODE_ARCH=$(os-apply-config -m $TE_DATAFILE --key arch)
if [ ! -e $TRIPLEO_ROOT/$DEPLOY_NAME.kernel -o \
! -e $TRIPLEO_ROOT/$DEPLOY_NAME.initramfs -o \
"$USE_CACHE" == "0" ] ; then
! -e $TRIPLEO_ROOT/$DEPLOY_NAME.initramfs -o \
"$USE_CACHE" == "0" ] ; then
### --include
$TRIPLEO_ROOT/diskimage-builder/bin/ramdisk-image-create -a $NODE_ARCH \
$NODE_DIST $DEPLOY_IMAGE_ELEMENT -o $TRIPLEO_ROOT/$DEPLOY_NAME \

View File

@ -5,7 +5,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options]"
echo
echo "Deploys a baremetal cloud via virsh."
@ -27,7 +27,10 @@ BUILD_ONLY=
DEBUG_LOGGING=
TEMP=$(getopt -o c,h -l all-nodes,build-only,debug-logging,help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -160,29 +163,29 @@ BM_BRIDGE_ROUTE=$(jq -r '.["baremetal-network"].seed.physical_bridge_route // {}
BM_CTL_ROUTE_PREFIX=$(jq -r '.["baremetal-network"].seed.physical_bridge_route.prefix // ""' $TE_DATAFILE)
BM_CTL_ROUTE_VIA=$(jq -r '.["baremetal-network"].seed.physical_bridge_route.via // ""' $TE_DATAFILE)
jq -s '
.[1]["baremetal-network"] as $bm
| ($bm.seed.ip // "192.0.2.1") as $bm_seed_ip
| .[2] as $bm_vlan
| .[3] as $bm_bridge_route
| .[0]
| . + {
"local-ipv4": $bm_seed_ip,
"completion-signal": ("http://'"${COMP_IP}"':'"${SEED_COMP_PORT}"'"),
"instance-id": "'"${SEED_IMAGE_ID}"'",
"bootstack": (.bootstack + {
"public_interface_ip": ($bm_seed_ip + "/'"${BM_NETWORK_CIDR##*/}"'"),
"masquerade_networks": ([$bm.cidr // "192.0.2.0/24"] + $bm_vlan.masquerade)
}),
"heat": (.heat + {
"watch_server_url": ("http://" + $bm_seed_ip + ":8003"),
"waitcondition_server_url": ("http://" + $bm_seed_ip + ":8000/v1/waitcondition"),
"metadata_server_url": ("http://" + $bm_seed_ip + ":8000")
}),
"neutron": (.neutron + {
"ovs": (.neutron.ovs + $bm_vlan.ovs + {"local_ip": $bm_seed_ip } + {
"physical_bridge_route": $bm_bridge_route
.[1]["baremetal-network"] as $bm
| ($bm.seed.ip // "192.0.2.1") as $bm_seed_ip
| .[2] as $bm_vlan
| .[3] as $bm_bridge_route
| .[0]
| . + {
"local-ipv4": $bm_seed_ip,
"completion-signal": ("http://'"${COMP_IP}"':'"${SEED_COMP_PORT}"'"),
"instance-id": "'"${SEED_IMAGE_ID}"'",
"bootstack": (.bootstack + {
"public_interface_ip": ($bm_seed_ip + "/'"${BM_NETWORK_CIDR##*/}"'"),
"masquerade_networks": ([$bm.cidr // "192.0.2.0/24"] + $bm_vlan.masquerade)
}),
"heat": (.heat + {
"watch_server_url": ("http://" + $bm_seed_ip + ":8003"),
"waitcondition_server_url": ("http://" + $bm_seed_ip + ":8000/v1/waitcondition"),
"metadata_server_url": ("http://" + $bm_seed_ip + ":8000")
}),
"neutron": (.neutron + {
"ovs": (.neutron.ovs + $bm_vlan.ovs + {"local_ip": $bm_seed_ip } + {
"physical_bridge_route": $bm_bridge_route
})
})
})
}' tmp_local.json $TE_DATAFILE bm-vlan.json <(echo "$BM_BRIDGE_ROUTE") > local.json
rm tmp_local.json
rm bm-vlan.json
@ -280,9 +283,9 @@ source $TRIPLEO_ROOT/tripleo-incubator/seedrc
## ::
if [ $USE_IRONIC -eq 0 ]; then
IRONIC_OPT=
IRONIC_OPT=
else
IRONIC_OPT="--ironic-password unset"
IRONIC_OPT="--ironic-password unset"
fi
## #. Perform setup of your seed cloud.
@ -393,13 +396,13 @@ nova quota-update --cores -1 --instances -1 --ram -1 $(keystone tenant-get admin
## ::
if [ -z "${ALL_NODES:-}" ]; then #nodocs
setup-baremetal --service-host seed --nodes <(jq '[.nodes[0]]' $TE_DATAFILE)
setup-baremetal --service-host seed --nodes <(jq '[.nodes[0]]' $TE_DATAFILE)
else #nodocs
## Otherwise, if you are skipping the undercloud, you should register all
## the nodes.::
setup-baremetal --service-host seed --nodes <(jq '.nodes' $TE_DATAFILE)
setup-baremetal --service-host seed --nodes <(jq '.nodes' $TE_DATAFILE)
fi #nodocs
## If you need to collect the MAC address separately, see ``scripts/get-vm-mac``.

View File

@ -8,7 +8,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options]"
echo
echo "Setup the TripleO devtest environment."
@ -25,7 +25,10 @@ CONTINUE=0
USE_CACHE=${USE_CACHE:-0}
TEMP=`getopt -o h,c -l trash-my-machine -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -248,9 +251,9 @@ fi
### --end
if [ "$USE_CACHE" == "0" ] ; then
if [ -z "${ZUUL_REF:-''}" ]; then
cd $TRIPLEO_ROOT/tripleo-incubator ; git pull
fi
if [ -z "${ZUUL_REF:-''}" ]; then
cd $TRIPLEO_ROOT/tripleo-incubator ; git pull
fi
fi
if [ "$NODE_DIST" == 'unsupported' ]; then

View File

@ -8,7 +8,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] {JSON-filename}"
echo
echo "Setup a TripleO devtest environment."
@ -46,7 +46,10 @@ SSH_KEY=~/.ssh/id_rsa_virt_power
KEEP_VMS=
TEMP=$(getopt -o h,n:,b:,s: -l nodes:,bm-networks:,keep-vms -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -124,9 +127,9 @@ fi
### --end
if [ -n "$NODES_PATH" ]; then
NODE_CNT=${NODE_CNT:-0}
NODE_CNT=${NODE_CNT:-0}
else
NODE_CNT=${NODE_CNT:-15}
NODE_CNT=${NODE_CNT:-15}
fi
NODE_CPU=${NODE_CPU:-1} NODE_MEM=${NODE_MEM:-3072} NODE_DISK=${NODE_DISK:-40} NODE_ARCH=${NODE_ARCH:-i386}
@ -198,10 +201,10 @@ HOSTIP=${HOSTIP:-192.168.122.1}
## ::
if [ -n "$NETS_PATH" ]; then
# if the value is not set try the default 192.0.2.1.
SEEDIP=$(jq '.["seed"]["ip"] // "192.0.2.1"' -r $NETS_PATH)
# if the value is not set try the default 192.0.2.1.
SEEDIP=$(jq '.["seed"]["ip"] // "192.0.2.1"' -r $NETS_PATH)
else
SEEDIP=${SEEDIP:-''}
SEEDIP=${SEEDIP:-''}
fi
@ -257,8 +260,8 @@ devtest_update_network.sh ${NETS_PATH:+--bm-networks $NETS_PATH} $JSONFILE
## ::
if [ -n "$NODES_PATH" ]; then
JSON=$(jq -s '.[0].nodes=.[1] | .[0]' $JSONFILE $NODES_PATH)
echo "${JSON}" > $JSONFILE
JSON=$(jq -s '.[0].nodes=.[1] | .[0]' $JSONFILE $NODES_PATH)
echo "${JSON}" > $JSONFILE
else
## #. Create baremetal nodes for the test cluster. If the required number of

View File

@ -11,7 +11,7 @@ DEBUG_LOGGING=
HEAT_ENV=
FLAVOR="baremetal"
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options]"
echo
echo "Deploys a baremetal cloud via heat."
@ -31,7 +31,10 @@ function show_options () {
}
TEMP=$(getopt -o c,h -l build-only,debug-logging,heat-env:,flavor:,help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -98,15 +101,15 @@ UNDERCLOUD_STACK_TIMEOUT=${UNDERCLOUD_STACK_TIMEOUT:-60}
NODE_ARCH=$(os-apply-config -m $TE_DATAFILE --key arch --type raw)
if [ ! -e $TRIPLEO_ROOT/undercloud.qcow2 -o "$USE_CACHE" == "0" ] ; then #nodocs
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
-a $NODE_ARCH -o $TRIPLEO_ROOT/undercloud \
ntp baremetal boot-stack os-collect-config dhcp-all-interfaces \
neutron-dhcp-agent $DIB_COMMON_ELEMENTS $UNDERCLOUD_DIB_EXTRA_ARGS 2>&1 | \
tee $TRIPLEO_ROOT/dib-undercloud.log
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
-a $NODE_ARCH -o $TRIPLEO_ROOT/undercloud \
ntp baremetal boot-stack os-collect-config dhcp-all-interfaces \
neutron-dhcp-agent $DIB_COMMON_ELEMENTS $UNDERCLOUD_DIB_EXTRA_ARGS 2>&1 | \
tee $TRIPLEO_ROOT/dib-undercloud.log
### --end
fi
if [ -n "$BUILD_ONLY" ]; then
exit 0
exit 0
fi
### --include
@ -132,20 +135,20 @@ UNDERCLOUD_NTP_SERVER=${UNDERCLOUD_NTP_SERVER:-''}
## #. Create secrets for the cloud. The secrets will be written to a file
## ($TRIPLEO_ROOT/tripleo-undercloud-passwords by default)
## that you need to source into your shell environment.
##
##
## .. note::
##
##
## You can also make or change these later and
## update the heat stack definition to inject them - as long as you also
## update the keystone recorded password.
##
##
## .. note::
##
##
## There will be a window between updating keystone and
## instances where they will disagree and service will be down. Instead
## consider adding a new service account and changing everything across
## to it, then deleting the old account after the cluster is updated.
##
##
## ::
### --end
@ -157,14 +160,14 @@ UNDERCLOUD_NTP_SERVER=${UNDERCLOUD_NTP_SERVER:-''}
# different environment you wish to use.
#
if [ -e tripleo-undercloud-passwords ]; then
echo "Re-using existing passwords in $PWD/tripleo-undercloud-passwords"
# Add any new passwords since the file was generated
setup-undercloud-passwords tripleo-undercloud-passwords
source tripleo-undercloud-passwords
echo "Re-using existing passwords in $PWD/tripleo-undercloud-passwords"
# Add any new passwords since the file was generated
setup-undercloud-passwords tripleo-undercloud-passwords
source tripleo-undercloud-passwords
else
### --include
setup-undercloud-passwords $TRIPLEO_ROOT/tripleo-undercloud-passwords
source $TRIPLEO_ROOT/tripleo-undercloud-passwords
setup-undercloud-passwords $TRIPLEO_ROOT/tripleo-undercloud-passwords
source $TRIPLEO_ROOT/tripleo-undercloud-passwords
fi #nodocs
## #. Export UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD to your environment
@ -237,13 +240,13 @@ else
if [ -n "$VLAN_ID" ]; then
HEAT_UNDERCLOUD_TEMPLATE="undercloud-vm-ironic-vlan.yaml"
ENV_JSON=$(jq .parameters.NeutronPublicInterfaceTag=\"${VLAN_ID}\" <<< $ENV_JSON)
# This should be in the heat template, but see
# https://bugs.launchpad.net/heat/+bug/1336656
# note that this will break if there are more than one subnet, as if
# more reason to fix the bug is needed :).
PUBLIC_SUBNET_ID=$(neutron net-show public | awk '/subnets/ { print $4 }')
VLAN_GW=$(neutron subnet-show $PUBLIC_SUBNET_ID | awk '/gateway_ip/ { print $4}')
BM_VLAN_CIDR=$(neutron subnet-show $PUBLIC_SUBNET_ID | awk '/cidr/ { print $4}')
# This should be in the heat template, but see
# https://bugs.launchpad.net/heat/+bug/1336656
# note that this will break if there are more than one subnet, as if
# more reason to fix the bug is needed :).
PUBLIC_SUBNET_ID=$(neutron net-show public | awk '/subnets/ { print $4 }')
VLAN_GW=$(neutron subnet-show $PUBLIC_SUBNET_ID | awk '/gateway_ip/ { print $4}')
BM_VLAN_CIDR=$(neutron subnet-show $PUBLIC_SUBNET_ID | awk '/cidr/ { print $4}')
ENV_JSON=$(jq .parameters.NeutronPublicInterfaceDefaultRoute=\"${VLAN_GW}\" <<< $ENV_JSON)
else
HEAT_UNDERCLOUD_TEMPLATE="undercloud-vm-ironic.yaml"
@ -270,29 +273,29 @@ fi
## #. Set parameters we need to deploy a baremetal undercloud::
ENV_JSON=$(jq '.parameters = {
"MysqlInnodbBufferPoolSize": 100
} + .parameters + {
"AdminPassword": "'"${UNDERCLOUD_ADMIN_PASSWORD}"'",
"AdminToken": "'"${UNDERCLOUD_ADMIN_TOKEN}"'",
"SnmpdReadonlyUserPassword": "'"${UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD}"'",
"GlancePassword": "'"${UNDERCLOUD_GLANCE_PASSWORD}"'",
"HeatPassword": "'"${UNDERCLOUD_HEAT_PASSWORD}"'",
"NovaPassword": "'"${UNDERCLOUD_NOVA_PASSWORD}"'",
"NeutronPassword": "'"${UNDERCLOUD_NEUTRON_PASSWORD}"'",
"NeutronPublicInterface": "'"${NeutronPublicInterface}"'",
"undercloudImage": "'"${UNDERCLOUD_ID}"'",
"BaremetalArch": "'"${NODE_ARCH}"'",
"PowerSSHPrivateKey": "'"${POWER_KEY}"'",
"NtpServer": "'"${UNDERCLOUD_NTP_SERVER}"'",
"Flavor": "'"${FLAVOR}"'"
}' <<< $ENV_JSON)
"MysqlInnodbBufferPoolSize": 100
} + .parameters + {
"AdminPassword": "'"${UNDERCLOUD_ADMIN_PASSWORD}"'",
"AdminToken": "'"${UNDERCLOUD_ADMIN_TOKEN}"'",
"SnmpdReadonlyUserPassword": "'"${UNDERCLOUD_CEILOMETER_SNMPD_PASSWORD}"'",
"GlancePassword": "'"${UNDERCLOUD_GLANCE_PASSWORD}"'",
"HeatPassword": "'"${UNDERCLOUD_HEAT_PASSWORD}"'",
"NovaPassword": "'"${UNDERCLOUD_NOVA_PASSWORD}"'",
"NeutronPassword": "'"${UNDERCLOUD_NEUTRON_PASSWORD}"'",
"NeutronPublicInterface": "'"${NeutronPublicInterface}"'",
"undercloudImage": "'"${UNDERCLOUD_ID}"'",
"BaremetalArch": "'"${NODE_ARCH}"'",
"PowerSSHPrivateKey": "'"${POWER_KEY}"'",
"NtpServer": "'"${UNDERCLOUD_NTP_SERVER}"'",
"Flavor": "'"${FLAVOR}"'"
}' <<< $ENV_JSON)
### --end
if [ "$DEBUG_LOGGING" = "1" ]; then
ENV_JSON=$(jq '.parameters = .parameters + {
"Debug": "True",
}' <<< $ENV_JSON)
"Debug": "True",
}' <<< $ENV_JSON)
fi
### --include
@ -300,8 +303,8 @@ fi
if [ "$USE_UNDERCLOUD_UI" -ne 0 ] ; then
ENV_JSON=$(jq '.parameters = .parameters + {
"CeilometerPassword": "'"${UNDERCLOUD_CEILOMETER_PASSWORD}"'"
}' <<< $ENV_JSON)
"CeilometerPassword": "'"${UNDERCLOUD_CEILOMETER_PASSWORD}"'"
}' <<< $ENV_JSON)
fi
## #. Save the finished environment file.::

View File

@ -4,7 +4,7 @@ set -eu
set -o pipefail
SCRIPT_NAME=$(basename $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME --bm-networks NETFILE {JSON-filename}"
echo
echo "Reads the baremetal-network description in NETFILE and writes it into JSON-filename"
@ -28,7 +28,10 @@ function show_options () {
NETS_PATH=
TEMP=$(getopt -o h -l help,bm-networks: -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -58,6 +61,6 @@ if [ -z "$JSONFILE" -o -n "$EXTRA_ARGS" ]; then
fi
if [ -n "$NETS_PATH" ]; then
JSON=$(jq -s '.[0]["baremetal-network"]=.[1] | .[0]' $JSONFILE $NETS_PATH)
echo "${JSON}" > $JSONFILE
JSON=$(jq -s '.[0]["baremetal-network"]=.[1] | .[0]' $JSONFILE $NETS_PATH)
echo "${JSON}" > $JSONFILE
fi

View File

@ -46,19 +46,19 @@ export TRIPLEO_ROOT=${TRIPLEO_ROOT:-} #nodocs
## NOTE(gfidente): Keep backwards compatibility by setting TRIPLEO_ROOT
## to ~/.cache/tripleo if the var is found empty and the dir exists.
if [ -z "$TRIPLEO_ROOT" -a -d ~/.cache/tripleo ]; then
echo "WARNING: Defaulting TRIPLEO_ROOT to ~/.cache/tripleo"
echo " Other environment variables are based on \$TRIPLEO_ROOT so"
echo " if you intend changing it, please source devtest_variables.sh"
echo " again afterwards."
TRIPLEO_ROOT=~/.cache/tripleo
echo "WARNING: Defaulting TRIPLEO_ROOT to ~/.cache/tripleo"
echo " Other environment variables are based on \$TRIPLEO_ROOT so"
echo " if you intend changing it, please source devtest_variables.sh"
echo " again afterwards."
TRIPLEO_ROOT=~/.cache/tripleo
fi
## NOTE(gfidente): Exit if TRIPLEO_ROOT is still empty or misconfigured
if [ -z "$TRIPLEO_ROOT" -o ! -d $TRIPLEO_ROOT/tripleo-incubator/scripts ]; then
echo 'ERROR: Cannot find $TRIPLEO_ROOT/tripleo-incubator/scripts'
echo ' To use devtest you must export the TRIPLEO_ROOT variable and have cloned tripleo-incubator within that directory.'
echo ' Check http://docs.openstack.org/developer/tripleo-incubator/devtest.html#initial-checkout for instructions.'
return 1
echo 'ERROR: Cannot find $TRIPLEO_ROOT/tripleo-incubator/scripts'
echo ' To use devtest you must export the TRIPLEO_ROOT variable and have cloned tripleo-incubator within that directory.'
echo ' Check http://docs.openstack.org/developer/tripleo-incubator/devtest.html#initial-checkout for instructions.'
return 1
fi
### --include
export PATH=$TRIPLEO_ROOT/tripleo-incubator/scripts:$TRIPLEO_ROOT/dib-utils/bin:$PATH

View File

@ -21,7 +21,7 @@ SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options]"
echo
echo "Extract documentation from our demonstration scripts."
@ -35,7 +35,10 @@ function show_options () {
}
TEMP=`getopt -o h -l help -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

View File

@ -4,8 +4,8 @@ set -eu
PATH=$PATH:/usr/sbin:/sbin
if [ "$#" -lt 1 ]; then
echo "Usage: $(basename $0) <vm-name>"
exit 1
echo "Usage: $(basename $0) <vm-name>"
exit 1
fi
VMNAME=$1
@ -14,7 +14,7 @@ vms=$(sudo virsh list --all | grep $VMNAME | awk '{ print $2 }')
macs=""
for vm in $vms ; do
macs="$(sudo virsh dumpxml $vm | grep "mac address" | head -1 | awk -F "'" '{ print $2 }') $macs"
macs="$(sudo virsh dumpxml $vm | grep "mac address" | head -1 | awk -F "'" '{ print $2 }') $macs"
done
echo $macs

View File

@ -28,63 +28,63 @@ chmod 0600 ~/.ssh/authorized_keys
# packages
if [ "$TRIPLEO_OS_DISTRO" = "unsupported" ]; then
echo This script has not been tested outside of Fedora, RHEL/CentOS, and Ubuntu variants.
echo Make sure you have installed all the needed dependencies or subsequent steps will fail.
echo This script has not been tested outside of Fedora, RHEL/CentOS, and Ubuntu variants.
echo Make sure you have installed all the needed dependencies or subsequent steps will fail.
fi
if [ "$TRIPLEO_OS_FAMILY" = "debian" ]; then
if $(grep -Eqs 'Ubuntu 12.04' /etc/lsb-release); then
#adding Ubuntu Cloud Archive Repository only if not present : bug https://bugs.launchpad.net/tripleo/+bug/1212237
#Ubuntu 12.04 has a too-old libvirt-bin but a newer one is present in the Ubuntu cloud archive.
sudo -E apt-get update
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install --yes ubuntu-cloud-keyring
(grep -Eqs "precise-updates/grizzly" /etc/apt/sources.list.d/cloud-archive.list) || echo 'deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main
' | sudo tee -a /etc/apt/sources.list.d/cloud-archive.list
#adding precise-backports universe repository for jq package
if ! command -v add-apt-repository; then
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install --yes python-software-properties
if $(grep -Eqs 'Ubuntu 12.04' /etc/lsb-release); then
#adding Ubuntu Cloud Archive Repository only if not present : bug https://bugs.launchpad.net/tripleo/+bug/1212237
#Ubuntu 12.04 has a too-old libvirt-bin but a newer one is present in the Ubuntu cloud archive.
sudo -E apt-get update
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install --yes ubuntu-cloud-keyring
(grep -Eqs "precise-updates/grizzly" /etc/apt/sources.list.d/cloud-archive.list) || echo 'deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main
' | sudo tee -a /etc/apt/sources.list.d/cloud-archive.list
#adding precise-backports universe repository for jq package
if ! command -v add-apt-repository; then
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install --yes python-software-properties
fi
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ precise-backports universe"
fi
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ precise-backports universe"
fi
# packages
sudo -E apt-get update
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install --yes python-lxml python-libvirt libvirt-bin qemu-utils qemu-system qemu-kvm git python-pip python-dev gcc python-virtualenv openvswitch-switch libssl-dev curl python-yaml parted lsb-release libxml2-dev libxslt1-dev jq openssh-server libffi-dev kpartx python-netaddr
# packages
sudo -E apt-get update
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install --yes python-lxml python-libvirt libvirt-bin qemu-utils qemu-system qemu-kvm git python-pip python-dev gcc python-virtualenv openvswitch-switch libssl-dev curl python-yaml parted lsb-release libxml2-dev libxslt1-dev jq openssh-server libffi-dev kpartx python-netaddr
if [ -f /lib/systemd/system/libvirtd.service ]; then
sudo service libvirtd restart
else
sudo service libvirt-bin restart
fi
if [ -f /lib/systemd/system/libvirtd.service ]; then
sudo service libvirtd restart
else
sudo service libvirt-bin restart
fi
fi
if [ "$TRIPLEO_OS_FAMILY" = "redhat" ]; then
# For CentOS, python-pip and jq are in EPEL
if [ "$TRIPLEO_OS_DISTRO" = "centos" ] && [ ! -f /etc/yum.repos.d/epel.repo ]; then
echo EPEL repository is required to install python-pip for CentOS.
echo See http://fedoraproject.org/wiki/EPEL
exit 1
fi
sudo -E yum install -y python-lxml libvirt-python libvirt qemu-img qemu-kvm git python-pip openssl-devel python-devel gcc audit python-virtualenv openvswitch python-yaml net-tools redhat-lsb-core libxslt-devel jq openssh-server libffi-devel which glusterfs-api python-netaddr
# For CentOS, python-pip and jq are in EPEL
if [ "$TRIPLEO_OS_DISTRO" = "centos" ] && [ ! -f /etc/yum.repos.d/epel.repo ]; then
echo EPEL repository is required to install python-pip for CentOS.
echo See http://fedoraproject.org/wiki/EPEL
exit 1
fi
sudo -E yum install -y python-lxml libvirt-python libvirt qemu-img qemu-kvm git python-pip openssl-devel python-devel gcc audit python-virtualenv openvswitch python-yaml net-tools redhat-lsb-core libxslt-devel jq openssh-server libffi-devel which glusterfs-api python-netaddr
sudo service libvirtd restart
sudo service openvswitch restart
sudo chkconfig openvswitch on
sudo service libvirtd restart
sudo service openvswitch restart
sudo chkconfig openvswitch on
fi
if [ "$TRIPLEO_OS_FAMILY" = "suse" ]; then
# Need these in path for sudo service & usermod to work
PATH=/sbin:/usr/sbin:$PATH
# TODO: this is a bit fragile, and assumes openSUSE, not SLES
suse_version=$(awk '/VERSION/ { print $3 }' /etc/SuSE-release)
if [ ! -f /etc/zypp/repos.d/Cloud_OpenStack_Master.repo ]; then
# Add Cloud:OpenStack:Master (Project that follows master branch with daily updates)
sudo -E zypper -n ar -f http://download.opensuse.org/repositories/Cloud:/OpenStack:/Master/openSUSE_$suse_version/Cloud:OpenStack:Master.repo
sudo -E zypper -n --gpg-auto-import-keys ref
fi
sudo -E zypper --non-interactive install \
python-lxml libvirt-python libvirt qemu-tools kvm git python-pip libopenssl-devel \
python-devel gcc audit python-virtualenv openvswitch-switch python-PyYAML net-tools \
lsb-release libxslt-devel jq libffi-devel python-netaddr
sudo service libvirtd restart
sudo service openvswitch-switch restart
# Need these in path for sudo service & usermod to work
PATH=/sbin:/usr/sbin:$PATH
# TODO: this is a bit fragile, and assumes openSUSE, not SLES
suse_version=$(awk '/VERSION/ { print $3 }' /etc/SuSE-release)
if [ ! -f /etc/zypp/repos.d/Cloud_OpenStack_Master.repo ]; then
# Add Cloud:OpenStack:Master (Project that follows master branch with daily updates)
sudo -E zypper -n ar -f http://download.opensuse.org/repositories/Cloud:/OpenStack:/Master/openSUSE_$suse_version/Cloud:OpenStack:Master.repo
sudo -E zypper -n --gpg-auto-import-keys ref
fi
sudo -E zypper --non-interactive install \
python-lxml libvirt-python libvirt qemu-tools kvm git python-pip libopenssl-devel \
python-devel gcc audit python-virtualenv openvswitch-switch python-PyYAML net-tools \
lsb-release libxslt-devel jq libffi-devel python-netaddr
sudo service libvirtd restart
sudo service openvswitch-switch restart
fi

View File

@ -23,7 +23,7 @@ SCRIPT_HOME=$(dirname $0)
# save stdout for later then make fd 1 stderr
exec 3>&1 >&2
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] <file>"
echo
echo "Load an image into Glance for use with Nova BareMetal driver"
@ -35,11 +35,11 @@ function show_options () {
exit 0
}
function cleanup() {
function cleanup {
rm -rf $TMP_IMAGE_DIR
}
function remove_image() {
function remove_image {
NAME=$1
UUIDS=$(glance image-list | awk "/$NAME/ {print \$2}")
for UUID in $UUIDS; do
@ -48,7 +48,7 @@ function remove_image() {
done
}
function load_image() {
function load_image {
FILE=$(readlink -f $1)
DIR=$(dirname ${FILE})
GLANCE_IMAGE_NAME=$(basename ${FILE%.*})
@ -93,16 +93,18 @@ function load_image() {
remove_image "${GLANCE_IMAGE_NAME}"
fi
kernel_id=$(glance image-create --name "${GLANCE_IMAGE_NAME}-vmlinuz" \
--is-public True \
--disk-format aki \
--file "$KERNEL" \
| grep ' id ' | awk '{print $4}')
ramdisk_id=$(glance image-create --name "${GLANCE_IMAGE_NAME}-initrd" \
--is-public True \
--disk-format ari \
--file "$RAMDISK" \
| grep ' id ' | awk '{print $4}')
kernel_id=$(glance image-create \
--name "${GLANCE_IMAGE_NAME}-vmlinuz" \
--is-public True \
--disk-format aki \
--file "$KERNEL" \
| grep ' id ' | awk '{print $4}')
ramdisk_id=$(glance image-create \
--name "${GLANCE_IMAGE_NAME}-initrd" \
--is-public True \
--disk-format ari \
--file "$RAMDISK" \
| grep ' id ' | awk '{print $4}')
# >&3 sends to the original stdout as this is what we are after
glance image-create --name $GLANCE_IMAGE_NAME \
@ -119,7 +121,10 @@ function load_image() {
TEMP=`getopt -o hd -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -133,7 +138,9 @@ while true ; do
esac
done
for arg do FILES="$FILES $arg" ; done
for arg; do
FILES="$FILES $arg";
done
if [ ! "$FILES" ]; then
show_options

View File

@ -23,7 +23,7 @@ SCRIPT_HOME=$(dirname $0)
GROUP=""
PASSWORD=""
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] <username> <useremail>"
echo
echo "Create a well formed user in a cloud."
@ -42,7 +42,10 @@ function show_options () {
}
TEMP=`getopt -o p: -l password: -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

View File

@ -21,7 +21,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME"
echo
echo "Create a random password."
@ -35,7 +35,10 @@ function show_options () {
}
TEMP=`getopt -o h -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

View File

@ -34,7 +34,7 @@ CHANNEL=$1
touch $LAST
function sendmessage(){
function sendmessage {
PEOPLE=$(cut -d , -f 1 $SCRIPTDIR/../tripleo-cloud/tripleo-cd-admins | xargs echo)
$SCRIPTDIR/send-irc $CHANNEL CLOUDOUTAGE "$PEOPLE $(sed -e 's/^ircmessage: \?//g' $CURRENT | xargs -0 -I LINE echo -n " --" LINE)"
NEXTMESSAGE=$(( $(date +%s) + 1800 ))

View File

@ -31,14 +31,14 @@ __tripleo_refresh_env() {
# Setup/update your undercloud environment to run devtest_overcloud.sh
#
if [ -z "${1:-}" ] ; then
echo "Usage:"
echo "source refresh-env TRIPLEO_ROOT"
echo "Ex:"
echo "source refresh-env ~/tripleo"
echo "Usage:"
echo "source refresh-env TRIPLEO_ROOT"
echo "Ex:"
echo "source refresh-env ~/tripleo"
else
if [ -d "$1/tripleo-incubator/scripts" ] ; then
__tripleo_refresh_env $1
else
echo "TRIPLEO_ROOT must contain tripleo-incubator/scripts"
fi
if [ -d "$1/tripleo-incubator/scripts" ] ; then
__tripleo_refresh_env $1
else
echo "TRIPLEO_ROOT must contain tripleo-incubator/scripts"
fi
fi

View File

@ -26,7 +26,7 @@ INTERNAL_URL=""
REGION="regionOne" # NB: This is the default keystone uses.
DEBUG=""
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] <name> <type> <public_url>"
echo
echo "Register a service and create an endpoint for it."
@ -52,7 +52,10 @@ function show_options () {
}
TEMP=`getopt -o d:a:i:r: -l debug,description:,admin:,internal:,region: -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -60,7 +63,7 @@ eval set -- "$TEMP"
while true ; do
case "$1" in
-d | --description) export DESCRIPTION="$2"; shift 2 ;;
--debug) export DEBUG="--debug"; shift 1 ;;
--debug) export DEBUG="--debug"; shift 1 ;;
-a | --admin) export ADMIN_URL="$2"; shift 2 ;;
-i | --internal) export INTERNAL_URL="$2"; shift 2 ;;
-r | --region) export REGION="$2"; shift 2 ;;
@ -153,23 +156,26 @@ if [ "dashboard" != "$TYPE" ]; then
fi
if ! keystone user-role-list --tenant-id $SERVICE_TENANT --user-id $USER_ID | grep -q " $ADMIN_ROLE "; then
echo "Creating user-role assignment for user $NAME, role admin, tenant service"
keystone user-role-add $DEBUG --tenant-id $SERVICE_TENANT \
--user-id $USER_ID \
--role-id $ADMIN_ROLE
keystone user-role-add $DEBUG \
--tenant-id $SERVICE_TENANT \
--user-id $USER_ID \
--role-id $ADMIN_ROLE
fi
#Add the admin tenant role for ceilometer user to enable polling services
if [ "metering" == "$TYPE" ]; then
ADMIN_TENANT=$(keystone $DEBUG tenant-list | awk '/ admin / {print $2}')
if ! keystone user-role-list --tenant-id $ADMIN_TENANT --user-id $USER_ID | grep -q " $ADMIN_ROLE "; then
echo "Creating user-role assignment for user $NAME, role admin, tenant admin"
keystone user-role-add $DEBUG --tenant-id $ADMIN_TENANT \
--user-id $USER_ID \
--role-id $ADMIN_ROLE
keystone user-role-add $DEBUG \
--tenant-id $ADMIN_TENANT \
--user-id $USER_ID \
--role-id $ADMIN_ROLE
#swift polling requires ResellerAdmin role to be added to the Ceilometer user
RESELLER_ADMIN_ROLE=$(keystone $DEBUG role-list | awk '/ ResellerAdmin / {print $2}')
keystone user-role-add $DEBUG --tenant-id $ADMIN_TENANT \
--user-id $USER_ID \
--role-id $RESELLER_ADMIN_ROLE
keystone user-role-add $DEBUG \
--tenant-id $ADMIN_TENANT \
--user-id $USER_ID \
--role-id $RESELLER_ADMIN_ROLE
fi
fi

View File

@ -22,7 +22,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(cd $(dirname $0); pwd)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME <cloud>"
echo
echo "Options:"
@ -42,7 +42,10 @@ function show_options () {
}
TEMP=`getopt -o h -l help,root: -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

View File

@ -19,7 +19,7 @@ set -eu
SCRIPT_NAME=$(basename $0)
function show_options() {
function show_options {
echo "Usage: $SCRIPT_NAME IRC_CHANNEL IRC_USERNAME MESSAGE..."
echo
echo "Send a MESSAGE to a freenode channel IRC_CHANNEL from"

View File

@ -22,7 +22,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(cd $(dirname $0); pwd)
function show_options () {
function show_options {
echo
echo "Usage: $SCRIPT_NAME file|directory ..[file|directory]"
echo
@ -49,7 +49,10 @@ function show_options () {
}
TEMP=`getopt -o h -l help -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -67,10 +70,8 @@ if (( $# <= 0 )); then
show_options 1 >&2
fi
for target in $*
do
for ent in $(find ${target} -type f -name dib-pip-manifest\* )
do
for target in $*; do
for ent in $(find ${target} -type f -name dib-pip-manifest\* ); do
echo DIB_PIP_MANIFEST_${ent##*dib-pip-manifest-}=${ent};
done
done 2>/dev/null | sort -t = -k1 -u

View File

@ -21,7 +21,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(cd $(dirname $0); pwd)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] local_repo [...]"
echo " e.g. use locally cloned repositories as input:"
echo " $SCRIPT_NAME -l /my/local/neutron /a/local/nova"
@ -62,7 +62,10 @@ function show_options () {
}
TEMP=`getopt -o h,l,n,r:,m: -l help,local,no-echo,no_echo,remote:,manifest: -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -92,34 +95,30 @@ if [[ "$((USE_LOCAL + USE_REMOTE + USE_MANIFEST))" != "1" ]]; then
show_options 1 >&2
fi
transform_manifest() {
while read name _type _dest loc ref
do
function transform_manifest {
while read name _type _dest loc ref; do
name_transformed=$(echo "$name" | tr '[:upper:]-' '[:lower:]_')
echo "export DIB_REPOLOCATION_${name_transformed}=$loc"
echo "export DIB_REPOREF_${name_transformed}=$ref"
done
}
use_manifest() {
for manifest in "${MANIFEST}"
do
function use_manifest {
for manifest in "${MANIFEST}"; do
transform_manifest < ${manifest}
done | sort -ut _ -k3
}
get_location() {
function get_location {
local remote_name=${1:-""}
if [[ -n "${remote_name}" ]] ; then
git config --get remote.${remote_name}.url
elif [[ "${USE_LOCAL}" == "1" ]]; then
# Find the .git directory
local dir="$(pwd)"
while [[ "${dir}" != "/" ]]
do
if [[ -d "${dir}/.git" ]]
then
while [[ "${dir}" != "/" ]]; do
if [[ -d "${dir}/.git" ]]; then
echo ${dir}
break
fi
@ -132,20 +131,19 @@ get_location() {
fi
}
get_ref() {
function get_ref {
git rev-parse HEAD
}
get_name() {
function get_nam {
local remote_name=${1:-""}
name=$(get_location ${remote_name})
echo $(basename ${name##*:} .git)
}
use_repos() {
function use_repos {
declare -A a
for dir in "${REPOS[@]}"
do
for dir in "${REPOS[@]}"; do
if [[ ! -d ${dir} ]] ; then
echo "Not a directory: ${dir}" >&2
exit 1

View File

@ -34,32 +34,32 @@ fi
REMOTE_OPERATIONS=${REMOTE_OPERATIONS:-0}
if [ "$REMOTE_OPERATIONS" != 1 -a -n "$TE_DATAFILE" -a -e "$TE_DATAFILE" ]; then
REMOTE_OPERATIONS=$(jq '.["remote-operations"]' $TE_DATAFILE)
REMOTE_OPERATIONS=${REMOTE_OPERATIONS//\"}
REMOTE_OPERATIONS=$(jq '.["remote-operations"]' $TE_DATAFILE)
REMOTE_OPERATIONS=${REMOTE_OPERATIONS//\"}
fi
if [ $REMOTE_OPERATIONS != 1 ]; then
if ! id | grep -qw $LIBVIRTD_GROUP; then
echo "adding $USER to group $LIBVIRTD_GROUP"
sudo usermod -a -G $LIBVIRTD_GROUP $USER
if ! id | grep -qw $LIBVIRTD_GROUP; then
echo "adding $USER to group $LIBVIRTD_GROUP"
sudo usermod -a -G $LIBVIRTD_GROUP $USER
echo "$USER was just added to the $LIBVIRTD_GROUP. Devtest will not"
echo "be able to continue until you start a new session to pick up the"
echo "new group membership. This can be done by either logging out and"
echo "back in, or running:"
echo
echo "sudo su -l $USER"
echo
echo "To verify that your group membership is correct, you can use the"
echo "following command:"
echo
echo "id | grep $LIBVIRTD_GROUP"
echo
echo "Once you have verified your group membership, you should be able to"
echo "re-run devtest successfully or continue with devtest_testenv."
# We have to exit non-zero so the calling script knows to stop.
exit 1
fi
echo "$USER was just added to the $LIBVIRTD_GROUP. Devtest will not"
echo "be able to continue until you start a new session to pick up the"
echo "new group membership. This can be done by either logging out and"
echo "back in, or running:"
echo
echo "sudo su -l $USER"
echo
echo "To verify that your group membership is correct, you can use the"
echo "following command:"
echo
echo "id | grep $LIBVIRTD_GROUP"
echo
echo "Once you have verified your group membership, you should be able to"
echo "re-run devtest successfully or continue with devtest_testenv."
# We have to exit non-zero so the calling script knows to stop.
exit 1
fi
else
echo $TE_DATAFILE says to use remote operations\; not adding $USER to $LIBVIRTD_GROUP
echo $TE_DATAFILE says to use remote operations\; not adding $USER to $LIBVIRTD_GROUP
fi

View File

@ -21,7 +21,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options]"
echo
echo "Reads a JSON file describing machines for a baremetal cluster and"
@ -42,7 +42,10 @@ SERVICE_HOST=""
JSON_PATH=
TEMP=$(getopt -o h -l help,service-host:,nodes: -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -82,7 +85,7 @@ deploy_kernel_id=$(glance image-create --name bm-deploy-kernel --is-public True
deploy_ramdisk_id=$(glance image-create --name bm-deploy-ramdisk --is-public True \
--disk-format ari < "$deploy_ramdisk" | awk ' / id / {print $4}')
function cleanup_flavor () {
function cleanup_flavor {
local FLAVOR_NAME=${1:?"cleanup_flavor requires a flavor name"}
if nova flavor-show "$FLAVOR_NAME" &> /dev/null; then
nova flavor-delete "$FLAVOR_NAME"

View File

@ -5,7 +5,7 @@ BASE=$(readlink -f $(dirname $0)/..)
VENV_HOME=$BASE/openstack-tools
if [ ! -f $VENV_HOME/bin/activate ]; then
virtualenv --setuptools $VENV_HOME
virtualenv --setuptools $VENV_HOME
fi
# NOTE(derekh): we need to use +u to workaround an issue with the activate script
@ -38,6 +38,6 @@ pip install -U \
python-swiftclient
for tool in os-apply-config cinder nova glance heat keystone neutron swift ironic ceilometer openstack init-keystone generate-keystone-pki register-nodes setup-neutron; do
ln -sf $VENV_HOME/bin/$tool $BASE/scripts/$tool ;
ln -sf $VENV_HOME/bin/$tool $BASE/scripts/$tool ;
done
echo "Installed openstack client tool symlinks in $BASE/scripts"

View File

@ -20,7 +20,7 @@ set -eu
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] <controlplane-ip>"
echo
echo "Perform initial setup of a cloud running on <controlplane-ip>"
@ -68,7 +68,10 @@ PUBLIC=""
REGION="regionOne" #NB: This is the keystone default.
TEMP=`getopt -o r: -l region:,debug,ceilometer-password:,cinder-password:,glance-password:,heat-password:,ironic-password:,public:,neutron-password:,nova-password:,swift-password:,tuskar-password:,enable-horizon,ssl: -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -139,35 +142,35 @@ PASSWORD=$NOVA_PASSWORD register-endpoint $DEBUG -r $REGION -d "Nova Compute Ser
PASSWORD=$NOVA_PASSWORD register-endpoint $DEBUG -r $REGION -d "Nova Compute Service v3" nova computev3 -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
if [ -n "$CEILOMETER_PASSWORD" ]; then
# Updating Ceilometer to be like other services
NORMAL_PORT=8777
SSL_PORT=${SSL:+13777}
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
PASSWORD=$CEILOMETER_PASSWORD register-endpoint $DEBUG -r $REGION -d "Ceilometer Service" ceilometer metering -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
# Updating Ceilometer to be like other services
NORMAL_PORT=8777
SSL_PORT=${SSL:+13777}
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
PASSWORD=$CEILOMETER_PASSWORD register-endpoint $DEBUG -r $REGION -d "Ceilometer Service" ceilometer metering -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
fi
if [ -n "$CINDER_PASSWORD" ]; then
NORMAL_PORT=8776
SSL_PORT=${SSL:+13776}
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
PASSWORD=$CINDER_PASSWORD register-endpoint $DEBUG -r $REGION -d "Cinder Volume Service" cinder volume -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
PASSWORD=$CINDER_PASSWORD register-endpoint $DEBUG -r $REGION -d "Cinder Volume Service V2" cinderv2 volumev2 -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
NORMAL_PORT=8776
SSL_PORT=${SSL:+13776}
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
PASSWORD=$CINDER_PASSWORD register-endpoint $DEBUG -r $REGION -d "Cinder Volume Service" cinder volume -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
PASSWORD=$CINDER_PASSWORD register-endpoint $DEBUG -r $REGION -d "Cinder Volume Service V2" cinderv2 volumev2 -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
fi
if [ -n "$SWIFT_PASSWORD" ]; then
NORMAL_PORT=8080
SSL_PORT=${SSL:+13080}
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
PASSWORD=$SWIFT_PASSWORD register-endpoint $DEBUG -r $REGION -d "Swift Object Storage Service" swift object-store -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
NORMAL_PORT=8080
SSL_PORT=${SSL:+13080}
SSL_PORT=${SSL_PORT:-$NORMAL_PORT}
PASSWORD=$SWIFT_PASSWORD register-endpoint $DEBUG -r $REGION -d "Swift Object Storage Service" swift object-store -i ${INTERNAL_HOST}${NORMAL_PORT} ${PUBLIC_HOST}${SSL_PORT}
fi
if [ -n "$ENABLE_HORIZON" ]; then
# XXX: SSL not wired up yet.
register-endpoint $DEBUG -r $REGION -d "OpenStack Dashboard" horizon dashboard -i ${INTERNAL_HOST} ${INTERNAL_HOST}
fi
if [ -n "$IRONIC_PASSWORD" ]; then
# XXX: SSL not wired up yet.
PASSWORD=$IRONIC_PASSWORD register-endpoint $DEBUG -r $REGION -d "Ironic Service" ironic baremetal -i ${INTERNAL_HOST}6385 ${PUBLIC_HOST}6385
# XXX: SSL not wired up yet.
PASSWORD=$IRONIC_PASSWORD register-endpoint $DEBUG -r $REGION -d "Ironic Service" ironic baremetal -i ${INTERNAL_HOST}6385 ${PUBLIC_HOST}6385
fi
if [ -n "$TUSKAR_PASSWORD" ]; then
# XXX: SSL not wired up yet.
PASSWORD=$TUSKAR_PASSWORD register-endpoint $DEBUG -r $REGION -d "Tuskar Service" tuskar management -i ${INTERNAL_HOST}8585 ${PUBLIC_HOST}8585
# XXX: SSL not wired up yet.
PASSWORD=$TUSKAR_PASSWORD register-endpoint $DEBUG -r $REGION -d "Tuskar Service" tuskar management -i ${INTERNAL_HOST}8585 ${PUBLIC_HOST}8585
fi

View File

@ -22,10 +22,10 @@ state=${default_net%%:*}
autostart=${default_net##*:}
if [ "$state" != "active" ]; then
virsh net-start default
virsh net-start default
fi
if [ "$autostart" != "yes" ]; then
virsh net-autostart default
virsh net-autostart default
fi

View File

@ -21,7 +21,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] FILENAME"
echo
echo "Generate passwords for devtest and write them out to a file"
@ -36,7 +36,10 @@ function show_options () {
FILE=
TEMP=`getopt -o hof -l help,overwrite,file -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -54,8 +57,8 @@ done
FILE=${FILE:-$1}
if [ -z "$FILE" ]; then
echo "ERROR: Must provide a filename"
exit 1
echo "ERROR: Must provide a filename"
exit 1
fi
OVERWRITE=${OVERWRITE:-""}
@ -67,7 +70,7 @@ if [ -n "$OVERWRITE" ]; then
echo -n "" > $FILE
fi
generate_password() {
function generate_password {
local name=$1
if [ -z "$(grep "^$name=" $FILE)" ]; then
echo "$name=$(os-make-password)" >> $FILE

View File

@ -32,7 +32,7 @@ export IMAGE_NAME=seed
LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"virtio"}
LIBVIRT_DISK_BUS_TYPE=${LIBVIRT_DISK_BUS_TYPE:-"sata"}
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] <element> [<element> ...]"
echo
echo "Create a VM definition for the seed VM."
@ -54,7 +54,10 @@ function show_options () {
}
TEMP=`getopt -o ha:o:m:c:b:p:e: -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -115,16 +118,16 @@ if [[ $DIB_COMMON_ELEMENTS == *enable-serial-console* ]]; then
fi
configure-vm $EXTRAOPTS \
--name $IMAGE_NAME \
--image /var/lib/libvirt/images/$IMAGE_NAME.qcow2 \
--diskbus $LIBVIRT_DISK_BUS_TYPE \
--baremetal-interface $BRIDGE \
--engine $ENGINE \
--arch $SEED_ARCH \
--memory $MEMORY \
--cpus $CPUS \
--libvirt-nic-driver $LIBVIRT_NIC_DRIVER \
--seed
--name $IMAGE_NAME \
--image /var/lib/libvirt/images/$IMAGE_NAME.qcow2 \
--diskbus $LIBVIRT_DISK_BUS_TYPE \
--baremetal-interface $BRIDGE \
--engine $ENGINE \
--arch $SEED_ARCH \
--memory $MEMORY \
--cpus $CPUS \
--libvirt-nic-driver $LIBVIRT_NIC_DRIVER \
--seed
MAC=$(sudo virsh dumpxml $IMAGE_NAME | grep "mac address" | head -1 | awk -F "'" '{print $2}')
echo "Seed VM created with MAC ${MAC}"

View File

@ -21,7 +21,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] FILENAME"
echo
echo "Generate passwords for devtest and write them out to a file"
@ -36,7 +36,10 @@ function show_options () {
FILE=
TEMP=`getopt -o hof -l help,overwrite,file -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -54,8 +57,8 @@ done
FILE=${FILE:-$1}
if [ -z "$FILE" ]; then
echo "ERROR: Must provide a filename"
exit 1
echo "ERROR: Must provide a filename"
exit 1
fi
OVERWRITE=${OVERWRITE:-""}
@ -67,7 +70,7 @@ if [ -n "$OVERWRITE" ]; then
echo -n "" > $FILE
fi
generate_password() {
function generate_password {
local name=$1
if [ -z "$(grep "^$name=" $FILE)" ]; then
echo "$name=$(os-make-password)" >> $FILE

View File

@ -4,7 +4,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME"
echo
echo "Pull the latest tripleo-cd-admin ssh keys into a user account."
@ -21,7 +21,10 @@ function show_options () {
TEMP=$(getopt -o hu -l help,users -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

View File

@ -22,7 +22,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
function show_options() {
function show_options {
EXITVAL=${1:-1}
echo "Usage: $SCRIPT_NAME [-h] [-w TIMEOUT] [-l LOOP_COUNT] [-f FAIL_MATCH] [-s SUCCESS_MATCH] --delay SLEEP_TIME -- COMMAND"
echo
@ -73,7 +73,9 @@ fi
if [ $USE_ARGPARSE -eq 1 ]; then
set +e
TEMP=$(getopt -o h,w:,l:,d:,s:,f: -l help,walltime:,looptimeout:,delay:,success-match:,fail-match: -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then show_options ; fi
if [ $? != 0 ]; then
show_options;
fi
set -e
# Note the quotes around `$TEMP': they are essential!
@ -115,7 +117,7 @@ fi
ENDTIME=$(($(date +%s) + $TIMEOUT))
TIME_REMAINING=0
function update_time_remaining() {
function update_time_remaining {
CUR_TIME="$(date +%s)"
TIME_REMAINING=$(($ENDTIME - $CUR_TIME))
}
@ -123,7 +125,7 @@ function update_time_remaining() {
OUTPUT=
function check_cmd() {
function check_cmd {
STATUS=0
OUTPUT=$(eval $COMMAND 2>&1) || STATUS=$?
if [[ -n "$SUCCESSFUL_MATCH_OUTPUT" ]] \

View File

@ -5,7 +5,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [<nodes>] [options]"
echo
echo "Waits for \`nova hypervisor-stats\` to show some memory + vcpus are available."
@ -26,7 +26,10 @@ function show_options () {
}
TEMP=$(getopt -o h -l help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -58,7 +61,7 @@ if [ -z "$EXPECTED_MEM" ]; then
fi
nova hypervisor-stats | awk '
$2=="count" && $4 >= '"$EXPECTED_NODES"' { c++ };
$2=="memory_mb" && $4 >= '"$EXPECTED_MEM"' { c++ };
$2=="vcpus" && $4 >= '"$EXPECTED_VCPUS"' { c++ };
END { if (c != 3) exit 1 }'
$2=="count" && $4 >= '"$EXPECTED_NODES"' { c++ };
$2=="memory_mb" && $4 >= '"$EXPECTED_MEM"' { c++ };
$2=="vcpus" && $4 >= '"$EXPECTED_VCPUS"' { c++ };
END { if (c != 3) exit 1 }'

View File

@ -21,7 +21,7 @@ set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
function show_options {
echo "Usage: $SCRIPT_NAME [options] FILENAME"
echo
echo "Write devtest defined environment variables to a file."
@ -38,7 +38,10 @@ function show_options () {
FILE=
TEMP=`getopt -o hof -l help,overwrite,file -n $SCRIPT_NAME -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
@ -56,8 +59,8 @@ done
FILE=${FILE:-$1}
if [ -z "$FILE" ]; then
echo "ERROR: Must provide a filename"
exit 1
echo "ERROR: Must provide a filename"
exit 1
fi
OVERWRITE=${OVERWRITE:-""}

View File

@ -17,7 +17,7 @@ commands = python setup.py build_sphinx
[testenv:pep8]
deps = bashate
whitelist_externals = bash
commands = bash -c "find scripts -type f | xargs bashate -v"
commands = bash -c "./run-bashate.sh"
[flake8]
ignore = H803