mirror of https://github.com/samply/bridgehead.git
Report git errors
This commit is contained in:
parent
ab3a5790de
commit
9b3acb4899
|
@ -119,9 +119,13 @@ fixPermissions() {
|
||||||
|
|
||||||
source lib/monitoring.sh
|
source lib/monitoring.sh
|
||||||
|
|
||||||
fail_and_report() {
|
report_error() {
|
||||||
log ERROR "$2"
|
log ERROR "$2"
|
||||||
hc_send $1 "$2"
|
hc_send $1 "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
fail_and_report() {
|
||||||
|
report_error $@
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,12 +43,13 @@ for DIR in /etc/bridgehead $(pwd); do
|
||||||
old_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
|
old_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
|
||||||
if [ -z "$HTTP_PROXY_URL" ]; then
|
if [ -z "$HTTP_PROXY_URL" ]; then
|
||||||
log "INFO" "Git is using no proxy!"
|
log "INFO" "Git is using no proxy!"
|
||||||
git -C $DIR fetch 2>&1
|
OUT=$(git -C $DIR fetch 2>&1 && git -C $DIR pull 2>&1)
|
||||||
git -C $DIR pull 2>&1
|
|
||||||
else
|
else
|
||||||
log "INFO" "Git is using proxy ${HTTP_PROXY_URL} from ${CONFFILE}"
|
log "INFO" "Git is using proxy ${HTTP_PROXY_URL} from ${CONFFILE}"
|
||||||
git -c http.proxy=$HTTP_PROXY_URL -c https.proxy=$HTTPS_PROXY_URL -C $DIR fetch 2>&1
|
OUT=$(git -c http.proxy=$HTTP_PROXY_URL -c https.proxy=$HTTPS_PROXY_URL -C $DIR fetch 2>&1 && git -c http.proxy=$HTTP_PROXY_URL -c https.proxy=$HTTPS_PROXY_URL -C $DIR pull 2>&1)
|
||||||
git -c http.proxy=$HTTP_PROXY_URL -c https.proxy=$HTTPS_PROXY_URL -C $DIR pull 2>&1
|
fi
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
report_error 1 "Unable to update git $DIR: $OUT"
|
||||||
fi
|
fi
|
||||||
new_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
|
new_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
|
||||||
if [ "$old_git_hash" != "$new_git_hash" ]; then
|
if [ "$old_git_hash" != "$new_git_hash" ]; then
|
||||||
|
|
Loading…
Reference in New Issue