From 553e066acd6dc0e24efd52d459b530959f7ad0af Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Mon, 19 Apr 2021 16:13:45 -0600 Subject: [PATCH] Merge pull request #10403 from hashicorp/b-always-set-scriptchecks-hook client: always set script checks hook --- client/allocrunner/taskrunner/task_runner_hooks.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/allocrunner/taskrunner/task_runner_hooks.go b/client/allocrunner/taskrunner/task_runner_hooks.go index 7a86adc7f50..02c2525c4e9 100644 --- a/client/allocrunner/taskrunner/task_runner_hooks.go +++ b/client/allocrunner/taskrunner/task_runner_hooks.go @@ -138,14 +138,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) {