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