Merge "Ensure the OpenStack gate has access to the logs"
This commit is contained in:
commit
6c51932eba
@ -24,11 +24,16 @@ export TESTR_OPTS=${TESTR_OPTS:-''}
|
||||
export PYTHONUNBUFFERED=1
|
||||
# Extra options to pass to the AIO bootstrap process
|
||||
export BOOTSTRAP_OPTS=${BOOTSTRAP_OPTS:-''}
|
||||
# This variable is being added to ensure the gate job executes an exit
|
||||
# function at the end of the run.
|
||||
export OSA_GATE_JOB=true
|
||||
|
||||
## Functions -----------------------------------------------------------------
|
||||
info_block "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh
|
||||
|
||||
## Main ----------------------------------------------------------------------
|
||||
# Set gate job exit traps, this is run regardless of exit state when the job finishes.
|
||||
trap gate_job_exit_tasks EXIT
|
||||
|
||||
# Log some data about the instance and the rest of the system
|
||||
log_instance_info
|
||||
@ -80,8 +85,10 @@ pushd $(dirname ${0})/../tests
|
||||
bootstrap-aio.yml
|
||||
popd
|
||||
|
||||
# Implement the log directory link for openstack-infra log publishing
|
||||
# Implement the log directory
|
||||
mkdir -p /openstack/log
|
||||
|
||||
# Implement the log directory link for openstack-infra log publishing
|
||||
ln -sf /openstack/log $(dirname ${0})/../logs
|
||||
|
||||
pushd $(dirname ${0})/../playbooks
|
||||
|
@ -97,14 +97,6 @@ function ssh_key_create {
|
||||
|
||||
function exit_state {
|
||||
set +x
|
||||
# Check if the logs link is in place. This will only be true when the
|
||||
# environment was built by the gate-check-commit script.
|
||||
if [ -h $(dirname ${0})/../logs ]; then
|
||||
# Ensure that all directories may be traversed by all users, and that
|
||||
# all files are readable by all users.
|
||||
chmod --recursive o+rX $(dirname ${0})/../logs
|
||||
fi
|
||||
|
||||
TOTALSECONDS="$(( $(date +%s) - STARTTIME ))"
|
||||
info_block "Run Time = ${TOTALSECONDS} seconds || $((TOTALSECONDS / 60)) minutes"
|
||||
if [ "${1}" == 0 ];then
|
||||
@ -117,6 +109,7 @@ function exit_state {
|
||||
|
||||
function exit_success {
|
||||
set +x
|
||||
[[ "${OSA_GATE_JOB:-false}" = true ]] && gate_job_exit_tasks
|
||||
exit_state 0
|
||||
}
|
||||
|
||||
@ -125,9 +118,14 @@ function exit_fail {
|
||||
log_instance_info
|
||||
cat ${INFO_FILENAME}
|
||||
info_block "Error Info - $@"
|
||||
[[ "${OSA_GATE_JOB:-false}" = true ]] && gate_job_exit_tasks
|
||||
exit_state 1
|
||||
}
|
||||
|
||||
function gate_job_exit_tasks {
|
||||
[[ -d "/openstack/log" ]] && chmod -R 0777 /openstack/log
|
||||
}
|
||||
|
||||
function print_info {
|
||||
PROC_NAME="- [ $@ ] -"
|
||||
printf "\n%s%s\n" "$PROC_NAME" "${LINE:${#PROC_NAME}}"
|
||||
@ -258,7 +256,6 @@ function get_pip {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
## Signal traps --------------------------------------------------------------
|
||||
# Trap all Death Signals and Errors
|
||||
trap "exit_fail ${LINENO} $? 'Received STOP Signal'" SIGHUP SIGINT SIGTERM
|
||||
|
Loading…
x
Reference in New Issue
Block a user