added exit_hook hook

This commit is contained in:
Lukas Schauer
2017-01-29 15:48:03 +01:00
parent 0f299623be
commit 298a7e9aaf
3 changed files with 11 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ This file contains a log of major changes in dehydrated
- Added `--lock-suffix` option for allowing parallel execution
- Added `invalid_challenge` hook
- Added `request_failure` hook
- Added `exit_hook` hook
## [0.3.1] - 2016-09-13
## Changed

View File

@@ -221,7 +221,7 @@ init_system() {
_exiterr "Problem retrieving ACME/CA-URLs, check if your configured CA points to the directory entrypoint."
# Export some environment variables to be used in hook script
export WELLKNOWN BASEDIR CERTDIR CONFIG
export WELLKNOWN BASEDIR CERTDIR CONFIG COMMAND
# Checking for private key ...
register_new_key="no"
@@ -822,6 +822,7 @@ command_sign_domains() {
# remove temporary domains.txt file if used
[[ -n "${PARAM_DOMAIN:-}" ]] && rm -f "${DOMAINS_TXT}"
[[ -n "${HOOK}" ]] && "${HOOK}" "exit_hook"
exit 0
}

View File

@@ -89,7 +89,7 @@ invalid_challenge() {
}
request_failure() {
local STATUSCODE="${1}" REASON="${2}" REQTYPE=${3}
local STATUSCODE="${1}" REASON="${2}" REQTYPE="${3}"
# This hook is called when a HTTP request fails (e.g., when the ACME
# server is busy, returns an error, etc). It will be called upon any
@@ -105,5 +105,12 @@ request_failure() {
# The kind of request that was made (GET, POST...)
}
exit_hook() {
# This hook is called at the end of a dehydrated command and can be used
# to do some final (cleanup or other) tasks.
:
}
HANDLER="$1"; shift
"$HANDLER" "$@"