Fix syntax errors in the shell scripts under devstack/tools
This patch is fixing the syntax errors/warnings in the shell scripts under devstack/tools and add that directory to the tox bashate command. Change-Id: I957a88f5b7009fe92078eb3d53e225943d28a539 Partial-Bug: #1526518
This commit is contained in:
parent
2a5f6ded69
commit
49e273b1a5
@ -20,6 +20,6 @@ virsh list | grep -q $NAME && virsh destroy $NAME
|
|||||||
virsh list --inactive | grep -q $NAME && virsh undefine $NAME
|
virsh list --inactive | grep -q $NAME && virsh undefine $NAME
|
||||||
|
|
||||||
if virsh pool-list | grep -q $LIBVIRT_STORAGE_POOL ; then
|
if virsh pool-list | grep -q $LIBVIRT_STORAGE_POOL ; then
|
||||||
virsh vol-list $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME &&
|
virsh vol-list $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME &&
|
||||||
virsh vol-delete $VOL_NAME --pool $LIBVIRT_STORAGE_POOL
|
virsh vol-delete $VOL_NAME --pool $LIBVIRT_STORAGE_POOL
|
||||||
fi
|
fi
|
||||||
|
@ -40,12 +40,12 @@ fi
|
|||||||
|
|
||||||
pool_state=$(virsh pool-info $LIBVIRT_STORAGE_POOL | grep State | awk '{ print $2 }')
|
pool_state=$(virsh pool-info $LIBVIRT_STORAGE_POOL | grep State | awk '{ print $2 }')
|
||||||
if [ "$pool_state" != "running" ] ; then
|
if [ "$pool_state" != "running" ] ; then
|
||||||
[ ! -d /var/lib/libvirt/images ] && sudo mkdir /var/lib/libvirt/images
|
[ ! -d /var/lib/libvirt/images ] && sudo mkdir /var/lib/libvirt/images
|
||||||
virsh pool-start $LIBVIRT_STORAGE_POOL >&2
|
virsh pool-start $LIBVIRT_STORAGE_POOL >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$LOGDIR" ] ; then
|
if [ -n "$LOGDIR" ] ; then
|
||||||
mkdir -p "$LOGDIR"
|
mkdir -p "$LOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PREALLOC=
|
PREALLOC=
|
||||||
@ -54,25 +54,24 @@ if [ -f /etc/debian_version ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$LOGDIR" ] ; then
|
if [ -n "$LOGDIR" ] ; then
|
||||||
VM_LOGGING="--console-log $LOGDIR/${NAME}_console.log"
|
VM_LOGGING="--console-log $LOGDIR/${NAME}_console.log"
|
||||||
else
|
else
|
||||||
VM_LOGGING=""
|
VM_LOGGING=""
|
||||||
fi
|
fi
|
||||||
VOL_NAME="${NAME}.qcow2"
|
VOL_NAME="${NAME}.qcow2"
|
||||||
|
|
||||||
if ! virsh list --all | grep -q $NAME; then
|
if ! virsh list --all | grep -q $NAME; then
|
||||||
virsh vol-list --pool $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME &&
|
virsh vol-list --pool $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME &&
|
||||||
virsh vol-delete $VOL_NAME --pool $LIBVIRT_STORAGE_POOL >&2
|
virsh vol-delete $VOL_NAME --pool $LIBVIRT_STORAGE_POOL >&2
|
||||||
virsh vol-create-as $LIBVIRT_STORAGE_POOL ${VOL_NAME} ${DISK}G --format qcow2 $PREALLOC >&2
|
virsh vol-create-as $LIBVIRT_STORAGE_POOL ${VOL_NAME} ${DISK}G --format qcow2 $PREALLOC >&2
|
||||||
volume_path=$(virsh vol-path --pool $LIBVIRT_STORAGE_POOL $VOL_NAME)
|
volume_path=$(virsh vol-path --pool $LIBVIRT_STORAGE_POOL $VOL_NAME)
|
||||||
# Pre-touch the VM to set +C, as it can only be set on empty files.
|
# Pre-touch the VM to set +C, as it can only be set on empty files.
|
||||||
sudo touch "$volume_path"
|
sudo touch "$volume_path"
|
||||||
sudo chattr +C "$volume_path" || true
|
sudo chattr +C "$volume_path" || true
|
||||||
$TOP_DIR/scripts/configure-vm \
|
$TOP_DIR/scripts/configure-vm \
|
||||||
--bootdev network --name $NAME --image "$volume_path" \
|
--bootdev network --name $NAME --image "$volume_path" \
|
||||||
--arch $ARCH --cpus $CPU --memory $MEM --libvirt-nic-driver $LIBVIRT_NIC_DRIVER \
|
--arch $ARCH --cpus $CPU --memory $MEM --libvirt-nic-driver $LIBVIRT_NIC_DRIVER \
|
||||||
--emulator $EMULATOR --network $BRIDGE $VM_LOGGING >&2
|
--emulator $EMULATOR --network $BRIDGE $VM_LOGGING >&2
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# echo mac
|
# echo mac
|
||||||
|
5
tox.ini
5
tox.ini
@ -66,7 +66,6 @@ commands = {posargs}
|
|||||||
deps =
|
deps =
|
||||||
{env:BASHATE_INSTALL_PATH:bashate==0.3.2}
|
{env:BASHATE_INSTALL_PATH:bashate==0.3.2}
|
||||||
whitelist_externals = bash
|
whitelist_externals = bash
|
||||||
# TODO(lucasagomes): Check the tools/ directory as well
|
|
||||||
commands = bash -c "find {toxinidir}/devstack \
|
commands = bash -c "find {toxinidir}/devstack \
|
||||||
-not \( -type d -name .?\* -prune \) \ # prune all 'dot' dirs
|
-not \( -type d -name .?\* -prune \) \ # prune all 'dot' dirs
|
||||||
-type f \ # only files
|
-type f \ # only files
|
||||||
@ -74,9 +73,11 @@ commands = bash -c "find {toxinidir}/devstack \
|
|||||||
-not -name \*~ \ # skip editor files
|
-not -name \*~ \ # skip editor files
|
||||||
-not -name \*.xml \ # skip xml files
|
-not -name \*.xml \ # skip xml files
|
||||||
-not -name \*.template \ # skip template files
|
-not -name \*.template \ # skip template files
|
||||||
|
-not -wholename \*scripts/configure-vm \ # that's a python script
|
||||||
\( \
|
\( \
|
||||||
-name \*.sh -or \ # add files eding with .sh
|
-name \*.sh -or \ # add files eding with .sh
|
||||||
-wholename \*/lib/\* \ # add files under lib/
|
-wholename \*/lib/\* -or \ # add files under lib/
|
||||||
|
-wholename \*/tools/\* \ # add files under tools/
|
||||||
\) \
|
\) \
|
||||||
-print0 | xargs -0 bashate -v -iE006 -eE005,E042"
|
-print0 | xargs -0 bashate -v -iE006 -eE005,E042"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user