From 49e273b1a51324124851e4934c13c164a87a21ed Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Tue, 15 Dec 2015 20:12:01 +0000 Subject: [PATCH] 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 --- devstack/tools/ironic/scripts/cleanup-node | 4 +-- devstack/tools/ironic/scripts/create-node | 33 +++++++++++----------- tox.ini | 5 ++-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/devstack/tools/ironic/scripts/cleanup-node b/devstack/tools/ironic/scripts/cleanup-node index c4e4e706f4..2d9e73e414 100755 --- a/devstack/tools/ironic/scripts/cleanup-node +++ b/devstack/tools/ironic/scripts/cleanup-node @@ -20,6 +20,6 @@ virsh list | grep -q $NAME && virsh destroy $NAME virsh list --inactive | grep -q $NAME && virsh undefine $NAME if virsh pool-list | grep -q $LIBVIRT_STORAGE_POOL ; then - virsh vol-list $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME && - virsh vol-delete $VOL_NAME --pool $LIBVIRT_STORAGE_POOL + virsh vol-list $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME && + virsh vol-delete $VOL_NAME --pool $LIBVIRT_STORAGE_POOL fi diff --git a/devstack/tools/ironic/scripts/create-node b/devstack/tools/ironic/scripts/create-node index b018acddc9..562063ad4e 100755 --- a/devstack/tools/ironic/scripts/create-node +++ b/devstack/tools/ironic/scripts/create-node @@ -40,12 +40,12 @@ fi pool_state=$(virsh pool-info $LIBVIRT_STORAGE_POOL | grep State | awk '{ print $2 }') if [ "$pool_state" != "running" ] ; then - [ ! -d /var/lib/libvirt/images ] && sudo mkdir /var/lib/libvirt/images - virsh pool-start $LIBVIRT_STORAGE_POOL >&2 + [ ! -d /var/lib/libvirt/images ] && sudo mkdir /var/lib/libvirt/images + virsh pool-start $LIBVIRT_STORAGE_POOL >&2 fi if [ -n "$LOGDIR" ] ; then - mkdir -p "$LOGDIR" + mkdir -p "$LOGDIR" fi PREALLOC= @@ -54,25 +54,24 @@ if [ -f /etc/debian_version ]; then fi if [ -n "$LOGDIR" ] ; then - VM_LOGGING="--console-log $LOGDIR/${NAME}_console.log" + VM_LOGGING="--console-log $LOGDIR/${NAME}_console.log" else - VM_LOGGING="" + VM_LOGGING="" fi VOL_NAME="${NAME}.qcow2" if ! virsh list --all | grep -q $NAME; then - virsh vol-list --pool $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME && - 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 - 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. - sudo touch "$volume_path" - sudo chattr +C "$volume_path" || true - $TOP_DIR/scripts/configure-vm \ - --bootdev network --name $NAME --image "$volume_path" \ - --arch $ARCH --cpus $CPU --memory $MEM --libvirt-nic-driver $LIBVIRT_NIC_DRIVER \ - --emulator $EMULATOR --network $BRIDGE $VM_LOGGING >&2 - + virsh vol-list --pool $LIBVIRT_STORAGE_POOL | grep -q $VOL_NAME && + 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 + 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. + sudo touch "$volume_path" + sudo chattr +C "$volume_path" || true + $TOP_DIR/scripts/configure-vm \ + --bootdev network --name $NAME --image "$volume_path" \ + --arch $ARCH --cpus $CPU --memory $MEM --libvirt-nic-driver $LIBVIRT_NIC_DRIVER \ + --emulator $EMULATOR --network $BRIDGE $VM_LOGGING >&2 fi # echo mac diff --git a/tox.ini b/tox.ini index 8e2914f20b..3111bdae3e 100644 --- a/tox.ini +++ b/tox.ini @@ -66,7 +66,6 @@ commands = {posargs} deps = {env:BASHATE_INSTALL_PATH:bashate==0.3.2} whitelist_externals = bash -# TODO(lucasagomes): Check the tools/ directory as well commands = bash -c "find {toxinidir}/devstack \ -not \( -type d -name .?\* -prune \) \ # prune all 'dot' dirs -type f \ # only files @@ -74,9 +73,11 @@ commands = bash -c "find {toxinidir}/devstack \ -not -name \*~ \ # skip editor files -not -name \*.xml \ # skip xml 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 - -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"