From d66ebca331cdc21b94a9e4cdf9ad7a40e0b09177 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 20 Dec 2017 10:51:40 +1100 Subject: [PATCH] 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 --- modules/openstack_project/files/resync-hound-config.sh | 6 +++--- modules/openstack_project/manifests/codesearch.pp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openstack_project/files/resync-hound-config.sh b/modules/openstack_project/files/resync-hound-config.sh index b2a37baeeb..ec6c217682 100644 --- a/modules/openstack_project/files/resync-hound-config.sh +++ b/modules/openstack_project/files/resync-hound-config.sh @@ -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} diff --git a/modules/openstack_project/manifests/codesearch.pp b/modules/openstack_project/manifests/codesearch.pp index d1c76318bd..c1cac3d2bd 100644 --- a/modules/openstack_project/manifests/codesearch.pp +++ b/modules/openstack_project/manifests/codesearch.pp @@ -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}",