Skip to content

Commit

Permalink
client: always set script checks hook
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
shoenig committed Apr 19, 2021
1 parent fc8ffe9 commit 94399ff
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions client/allocrunner/taskrunner/task_runner_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 94399ff

Please sign in to comment.