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}",