Fix codesearch stderr capturing

Fix the stderr capture

Update the script slightly to be more robust cleaning up with an exit
trap, and put a date stamp in when the script starts to differentiate
runs in the logs.

Change-Id: Ie7a75d9151734799c4e4767e75f750b05957205b
This commit is contained in:
Ian Wienand 2017-12-20 10:51:40 +11:00
parent bd56a81619
commit d66ebca331
2 changed files with 4 additions and 4 deletions

View File

@ -18,8 +18,11 @@ PROJECTS_YAML=${PROJECTS_YAML:-/etc/project-config/gerrit/projects.yaml}
REINDEX_LOCK=/var/www/hound/reindex.lock
TEMP_DIR=$(mktemp -d)
trap "rm -rf ${TEMP_DIR} EXIT"
pushd ${TEMP_DIR}
echo $(date)
echo "Starting hound config update"
# Generate the new config
@ -30,7 +33,6 @@ NEW="$(md5sum config.json | awk '{print $1}')"
OLD="$(md5sum /home/hound/config.json | awk '{print $1}')"
if [[ ${NEW} == ${OLD} ]]; then
echo "Nothing to do"
rm -rf ${TEMP_DIR}
exit 0
fi
@ -60,5 +62,3 @@ rm ${REINDEX_LOCK}
echo "... done"
popd
rm -rf ${TEMP_DIR}

View File

@ -34,7 +34,7 @@ class openstack_project::codesearch (
user => root,
hour => '4',
minute => '0',
command => 'flock -n /var/run/hound.sync.lock resync-hound-config 2>&1 >> /var/log/hound.sync.log',
command => 'flock -n /var/run/hound.sync.lock resync-hound-config >> /var/log/hound.sync.log 2>&1',
environment => [
'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
"PROJECTS_YAML=${::project_config::jeepyb_project_file}",