client: always set script checks hook

Similar to a bugfix made for the services hook, we need to always
set the script checks hook, in case a task is initially launched
without script checks, but then updated to include script checks.

The scipt checks hook is the thing that handles that new registration.
This commit is contained in:
Seth Hoenig 2021-04-19 15:37:42 -06:00
parent 8140b0160c
commit 6e1c71446d

View file

@ -143,14 +143,15 @@ func (tr *TaskRunner) initHooks() {
}
}
// If there are any script checks, add the hook
scriptCheckHook := newScriptCheckHook(scriptCheckHookConfig{
// Always add the script checks hook. A task with no script check hook on
// initial registration may be updated to include script checks, which must
// be handled with this hook.
tr.runnerHooks = append(tr.runnerHooks, newScriptCheckHook(scriptCheckHookConfig{
alloc: tr.Alloc(),
task: tr.Task(),
consul: tr.consulServiceClient,
logger: hookLogger,
})
tr.runnerHooks = append(tr.runnerHooks, scriptCheckHook)
}))
}
func (tr *TaskRunner) emitHookError(err error, hookName string) {