diff --git a/plugin/type.go b/plugin/type.go index d5264a42..f1bb82d2 100644 --- a/plugin/type.go +++ b/plugin/type.go @@ -37,5 +37,5 @@ type PodStatusHook interface { // Execute is invoked when the pod.taskStatusCh channel has a new status. It returns an error on failure, // and also a flag "failExec" indicating if the error needs to fail the execution when a series of hooks are executed // This is to support cases where a few hooks can be executed in a best effort manner and need not fail the executor - Execute(podStatus string, data interface{}) (err error, failExec bool) + Execute(podStatus string, data interface{}) (failExec bool, err error) } \ No newline at end of file diff --git a/utils/pod/pod.go b/utils/pod/pod.go index 92dcaeaf..6b017907 100644 --- a/utils/pod/pod.go +++ b/utils/pod/pod.go @@ -1295,7 +1295,7 @@ func execPodStatusHooks(status string, taskInfo *mesos.TaskInfo) error { logger.Errorf("Hook %s is nil, not initialized? still continuing with available hooks", name) continue } - if pherr, failExec := hook.Execute(status, taskInfo); pherr != nil { + if failExec, pherr := hook.Execute(status, taskInfo); pherr != nil { logger.Errorf( "PodStatusHook %s failed with %v and is not best effort, so stopping further execution ", name, pherr) diff --git a/utils/pod/pod_test.go b/utils/pod/pod_test.go index 6662098b..3b93d7f3 100644 --- a/utils/pod/pod_test.go +++ b/utils/pod/pod_test.go @@ -243,15 +243,15 @@ type happyHook struct{} type mandatoryHook struct{} type panicHook struct{} -func (p *happyHook) Execute(podStatus string, data interface{}) (err error, bestEffort bool) { - return nil, true +func (p *happyHook) Execute(podStatus string, data interface{}) (failExec bool, err error) { + return true, nil } -func (p *mandatoryHook) Execute(status string, data interface{}) (err error, bestEffort bool) { - return errors.New("failure test case"), true +func (p *mandatoryHook) Execute(status string, data interface{}) (failExec bool, err error) { + return true, errors.New("failure test case") } -func (p *panicHook) Execute(status string, data interface{}) (err error, bestEffort bool) { +func (p *panicHook) Execute(status string, data interface{}) (failExec bool, err error) { panic("unit test panic") - return errors.New("panic test case"), false + return false, errors.New("panic test case") } \ No newline at end of file