From 5cdee8dd3311e501302993cd8c81b39cb6b45090 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 19 Oct 2015 14:17:18 +1100 Subject: [PATCH] Update to bashate 0.3.2 Bashate 0.3.2 has a few new checks -- firstly make sure some of the plugins have #!/bin/bash, and fix up a couple of "local" changes that were missed by I9c8912a8fd596535589b207d7fc553b9d951d3fe Change-Id: I9e4b1c0dc9e0f709d8e76f9c9bf1c9478b2605ed --- functions-common | 20 ++++++++++++++------ lib/heat | 12 ++++++++---- lib/neutron_plugins/services/firewall | 2 ++ lib/neutron_plugins/services/loadbalancer | 2 ++ lib/neutron_plugins/services/metering | 2 ++ lib/neutron_plugins/services/vpn | 2 ++ lib/neutron_thirdparty/vmware_nsx | 2 ++ tox.ini | 7 ++++--- 8 files changed, 36 insertions(+), 13 deletions(-) diff --git a/functions-common b/functions-common index 42555a95f5..ceefd443b1 100644 --- a/functions-common +++ b/functions-common @@ -1746,7 +1746,8 @@ function run_phase { # extras.d in an unsupported way which will let us track # unsupported usage in the gate. local exceptions="50-ironic.sh 60-ceph.sh 80-tempest.sh" - local extra=$(basename $extra_plugin_file_name) + local extra + extra=$(basename $extra_plugin_file_name) if [[ ! ( $exceptions =~ "$extra" ) ]]; then deprecated "extras.d support is being removed in Mitaka-1" deprecated "jobs for project $extra will break after that point" @@ -2184,14 +2185,21 @@ function time_start { # global counter for that name. Errors if that clock had not # previously been started. function time_stop { - local name=$1 - local start_time=${START_TIME[$name]} + local name + local end_time + local elpased_time + local total + local start_time + + name=$1 + start_time=${START_TIME[$name]} + if [[ -z "$start_time" ]]; then die $LINENO "Trying to stop the clock on $name, but it was never started" fi - local end_time=$(date +%s) - local elapsed_time=$(($end_time - $start_time)) - local total=${TOTAL_TIME[$name]:-0} + end_time=$(date +%s) + elapsed_time=$(($end_time - $start_time)) + total=${TOTAL_TIME[$name]:-0} # reset the clock so we can start it in the future START_TIME[$name]="" TOTAL_TIME[$name]=$(($total + $elapsed_time)) diff --git a/lib/heat b/lib/heat index 85fdaa1eb2..f3f0548947 100644 --- a/lib/heat +++ b/lib/heat @@ -239,7 +239,8 @@ function start_heat { run_process h-eng "$HEAT_BIN_DIR/heat-engine --config-file=$HEAT_CONF" # If the site is not enabled then we are in a grenade scenario - local enabled_site_file=$(apache_site_config_for heat-api) + local enabled_site_file + enabled_site_file=$(apache_site_config_for heat-api) if [ -f ${enabled_site_file} ] && [ "$HEAT_USE_MOD_WSGI" == "True" ]; then enable_apache_site heat-api enable_apache_site heat-api-cfn @@ -284,9 +285,12 @@ function _cleanup_heat_apache_wsgi { # _config_heat_apache_wsgi() - Set WSGI config files of Heat function _config_heat_apache_wsgi { - local heat_apache_conf=$(apache_site_config_for heat-api) - local heat_cfn_apache_conf=$(apache_site_config_for heat-api-cfn) - local heat_cloudwatch_apache_conf=$(apache_site_config_for heat-api-cloudwatch) + local heat_apache_conf + heat_apache_conf=$(apache_site_config_for heat-api) + local heat_cfn_apache_conf + heat_cfn_apache_conf=$(apache_site_config_for heat-api-cfn) + local heat_cloudwatch_apache_conf + heat_cloudwatch_apache_conf=$(apache_site_config_for heat-api-cloudwatch) local heat_ssl="" local heat_certfile="" local heat_keyfile="" diff --git a/lib/neutron_plugins/services/firewall b/lib/neutron_plugins/services/firewall index 61a148e596..3496da82f8 100644 --- a/lib/neutron_plugins/services/firewall +++ b/lib/neutron_plugins/services/firewall @@ -1,3 +1,5 @@ +#!/bin/bash + # Neutron firewall plugin # --------------------------- diff --git a/lib/neutron_plugins/services/loadbalancer b/lib/neutron_plugins/services/loadbalancer index 34190f9a56..7865f6fd6e 100644 --- a/lib/neutron_plugins/services/loadbalancer +++ b/lib/neutron_plugins/services/loadbalancer @@ -1,3 +1,5 @@ +#!/bin/bash + # Neutron loadbalancer plugin # --------------------------- diff --git a/lib/neutron_plugins/services/metering b/lib/neutron_plugins/services/metering index 37ba019b98..c75ab19d4e 100644 --- a/lib/neutron_plugins/services/metering +++ b/lib/neutron_plugins/services/metering @@ -1,3 +1,5 @@ +#!/bin/bash + # Neutron metering plugin # --------------------------- diff --git a/lib/neutron_plugins/services/vpn b/lib/neutron_plugins/services/vpn index 4d6a2bf9a0..c0e7457413 100644 --- a/lib/neutron_plugins/services/vpn +++ b/lib/neutron_plugins/services/vpn @@ -1,3 +1,5 @@ +#!/bin/bash + # Neutron VPN plugin # --------------------------- diff --git a/lib/neutron_thirdparty/vmware_nsx b/lib/neutron_thirdparty/vmware_nsx index 03853a9bf4..e182fca1ae 100644 --- a/lib/neutron_thirdparty/vmware_nsx +++ b/lib/neutron_thirdparty/vmware_nsx @@ -1,2 +1,4 @@ +#!/bin/bash + # REVISIT(roeyc): this file left empty so that 'enable_service vmware_nsx' # continues to work. diff --git a/tox.ini b/tox.ini index 0df9877ba8..9279455bb8 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ install_command = pip install {opts} {packages} [testenv:bashate] deps = - {env:BASHATE_INSTALL_PATH:bashate==0.3.1} + {env:BASHATE_INSTALL_PATH:bashate==0.3.2} whitelist_externals = bash commands = bash -c "find {toxinidir} \ -not \( -type d -name .?\* -prune \) \ # prune all 'dot' dirs @@ -20,12 +20,13 @@ commands = bash -c "find {toxinidir} \ -not -name \*.md \ \( \ -name \*.sh -or \ - -name \*rc -or \ + -name \*.orig -or \ + -name \*rc -or \ # openrc files, etc -name functions\* -or \ -wholename \*/inc/\* -or \ # /inc files and -wholename \*/lib/\* \ # /lib files are shell, but \) \ # have no extension - -print0 | xargs -0 bashate -v -iE006" + -print0 | xargs -0 bashate -v -iE006 -eE005,E042" [testenv:docs] deps =