diff --git a/playbooks/roles/repo_server/files/openstack-wheel-builder.sh b/playbooks/roles/repo_server/files/openstack-wheel-builder.sh index 41b6dd5c7b..3af0709251 100644 --- a/playbooks/roles/repo_server/files/openstack-wheel-builder.sh +++ b/playbooks/roles/repo_server/files/openstack-wheel-builder.sh @@ -83,17 +83,17 @@ EXCLUDE_RELEASES="${EXCLUDE_RELEASES:-v9.0.0 gh-pages revert}" # Name of the lock file. LOCKFILE="/tmp/wheel_builder.lock" -function my_trap_handler() { +function my_trap_handler { kill_job } -function lock_file_remove() { +function lock_file_remove { if [ -f "${LOCKFILE}" ]; then rm "${LOCKFILE}" fi } -function kill_job() { +function kill_job { set +e # If the job needs killing kill the pid and unlock the file. if [ -f "${LOCKFILE}" ]; then @@ -103,7 +103,7 @@ function kill_job() { fi } -function cleanup() { +function cleanup { # Ensure workspaces are cleaned up rm -rf /tmp/openstack_wheels* rm -rf /tmp/pip* diff --git a/scripts/run-upgrade.sh b/scripts/run-upgrade.sh index 4cde90aa34..b0ea3c7ee6 100755 --- a/scripts/run-upgrade.sh +++ b/scripts/run-upgrade.sh @@ -48,15 +48,15 @@ set -e -u -v info_block "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh ## Functions ----------------------------------------------------------------- -function get_inv_items(){ +function get_inv_items { ./scripts/inventory-manage.py -f /etc/openstack_deploy/openstack_inventory.json -l | grep -w ".*$1" } -function remove_inv_items(){ +function remove_inv_items { ./scripts/inventory-manage.py -f /etc/openstack_deploy/openstack_inventory.json -r "$1" } -function run_lock() { +function run_lock { set +e run_item="${RUN_TASKS[$1]}" file_part="${run_item}" diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index 8e1d0cc9c2..7e6468cd42 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -28,7 +28,7 @@ FORKS=${FORKS:-$(grep -c ^processor /proc/cpuinfo)} ## Functions ----------------------------------------------------------------- # Used to retry a process that may fail due to random issues. -function successerator() { +function successerator { set +e # Get the time that the method was started. OP_START_TIME="$(date +%s)" @@ -56,13 +56,13 @@ function successerator() { set -e } -function install_bits() { +function install_bits { # Use the successerator to run openstack-ansible with # the appropriate number of forks successerator openstack-ansible ${ANSIBLE_PARAMETERS} --forks ${FORKS} $@ } -function configure_diskspace() { +function configure_diskspace { # If there are any block devices available other than the one # used for the root disk, repurpose it for our needs. MIN_LXC_VG_SIZE_B=$((${MIN_LXC_VG_SIZE_GB} * 1024 * 1024 * 1024)) @@ -110,7 +110,7 @@ function configure_diskspace() { fi } -function ssh_key_create() { +function ssh_key_create { # Ensure that the ssh key exists and is an authorized_key key_path="${HOME}/.ssh" key_file="${key_path}/id_rsa" @@ -133,7 +133,7 @@ function ssh_key_create() { fi } -function loopback_create() { +function loopback_create { LOOP_FILENAME=${1} LOOP_FILESIZE=${2} LOOP_FILE_TYPE=${3} # thin, thick @@ -171,7 +171,7 @@ function loopback_create() { fi } -function exit_state() { +function exit_state { set +x TOTALSECONDS="$(( $(date +%s) - $STARTTIME ))" info_block "Run Time = ${TOTALSECONDS} seconds || $(($TOTALSECONDS / 60)) minutes" @@ -183,30 +183,30 @@ function exit_state() { exit ${1} } -function exit_success() { +function exit_success { set +x exit_state 0 } -function exit_fail() { +function exit_fail { set +x log_instance_info info_block "Error Info - $@" exit_state 1 } -function print_info() { +function print_info { PROC_NAME="- [ $@ ] -" printf "\n%s%s\n" "$PROC_NAME" "${LINE:${#PROC_NAME}}" } -function info_block(){ +function info_block { echo "${LINE}" print_info "$@" echo "${LINE}" } -function log_instance_info() { +function log_instance_info { set +x # Get host information post initial setup and reset verbosity if [ ! -d "/openstack/log/instance-info" ];then @@ -216,7 +216,7 @@ function log_instance_info() { set -x } -function get_repos_info() { +function get_repos_info { for i in /etc/apt/sources.list /etc/apt/sources.list.d/*; do echo -e "\n$i" cat $i @@ -224,7 +224,7 @@ function get_repos_info() { } # Get instance info -function get_instance_info() { +function get_instance_info { set +x info_block 'Current User' whoami @@ -278,7 +278,7 @@ function get_instance_info() { dpkg-query --list &> /openstack/log/instance-info/host_packages_info_$(date +%s).log } -function print_report() { +function print_report { # Print the stored report data echo -e "${REPORT_DATA}" } diff --git a/tox.ini b/tox.ini index b6a0a8da04..71902de22e 100644 --- a/tox.ini +++ b/tox.ini @@ -28,4 +28,4 @@ commands = bash -c "find {toxinidir} \ -not -path '*/\.*' \ # stay out of the dot directories -name '*sh' \ # all shell scripts please - -print0 | xargs -0 bashate -v -i E003,E010,E011,E020" + -print0 | xargs -0 bashate -v -i E003,E010,E011"