Split out puppet logs
To improve troubleshooting and readability, let's not have the puppet logs print to the console. This change updates the puppet apply to output the logs to puppet.log which will still be captured and provided in the CI results. When the puppet apply fails, we will grep for warnings and errors from the puppet log and only print those out which should simplify troubleshooting failures. Change-Id: I1084223f805f1960aebb9c5868fdef84ff3667e4
This commit is contained in:
parent
5bec5495b2
commit
e4c6f48efa
@ -55,6 +55,9 @@ done
|
||||
# some commands could fail if service failed to be installed during Puppet runs
|
||||
set +e
|
||||
|
||||
# Copy puppet log
|
||||
cp ${WORKSPACE}/puppet*.log $LOG_DIR
|
||||
|
||||
# Archive the project config & logs
|
||||
mkdir $LOG_DIR/etc/
|
||||
for p in $PROJECTS; do
|
||||
|
@ -203,3 +203,11 @@ function catch_selinux_alerts() {
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function timestamp_puppet_log() {
|
||||
mv ${WORKSPACE}/puppet.log ${WORKSPACE}/puppet-$(date +%Y%m%d_%H%M%S).log
|
||||
}
|
||||
|
||||
function catch_puppet_failures() {
|
||||
grep -iE '(warning|error)' ${WORKSPACE}/puppet.log
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export SWAP_SIZE_GB=${SWAP_SIZE_GB:-2}
|
||||
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
|
||||
export HIERA_CONFIG=${HIERA_CONFIG:-${SCRIPT_DIR}/hiera/hiera.yaml}
|
||||
export MANAGE_HIERA=${MANAGE_HIERA:-true}
|
||||
export PUPPET_ARGS="${PUPPET_ARGS} --detailed-exitcodes --color=false --test --trace --hiera_config ${HIERA_CONFIG}"
|
||||
export PUPPET_ARGS="${PUPPET_ARGS} --detailed-exitcodes --color=false --test --trace --hiera_config ${HIERA_CONFIG} --logdest ${WORKSPACE}/puppet.log"
|
||||
export DISTRO=$(lsb_release -c -s)
|
||||
|
||||
# NOTE(pabelanger): Setup facter to know about AFS mirror.
|
||||
@ -152,10 +152,12 @@ RESULT=$?
|
||||
set -e
|
||||
if [ $RESULT -ne 0 ] && [ $RESULT -ne 2 ]; then
|
||||
print_header 'First Puppet run contains errors in catalog.'
|
||||
catch_puppet_failures
|
||||
print_header 'SELinux Alerts (1st time)'
|
||||
catch_selinux_alerts
|
||||
exit 1
|
||||
fi
|
||||
timestamp_puppet_log
|
||||
|
||||
# Run puppet a second time and assert nothing changes.
|
||||
set +e
|
||||
@ -165,10 +167,12 @@ RESULT=$?
|
||||
set -e
|
||||
if [ $RESULT -ne 0 ]; then
|
||||
print_header 'Second Puppet run is not idempotent.'
|
||||
catch_puppet_failures
|
||||
print_header 'SELinux Alerts (2nd time)'
|
||||
catch_selinux_alerts
|
||||
exit 1
|
||||
fi
|
||||
timestamp_puppet_log
|
||||
|
||||
print_header 'Prepare Tempest'
|
||||
# Tempest plugin tests require tempest-lib to be installed
|
||||
|
Loading…
Reference in New Issue
Block a user