fix: perform hook null check before waiting
Last 2 commits introduced fatal null-pointer exception when waiting on HookRunner object when not set, e.g. waiting for WebhookRunner when no webhook is defined. Fixed bug and got test_e2e.sh to run successfully.
This commit is contained in:
parent
5490b721d8
commit
394b2c7149
|
|
@ -638,14 +638,18 @@ func main() {
|
|||
// Assumes that if hook channels are not nil, they will have at
|
||||
// least one value before getting closed
|
||||
exitCode := 0 // is 0 if all hooks succeed, else is 1
|
||||
if exechookRunner != nil {
|
||||
if err = exechookRunner.WaitForCompletion(); err != nil {
|
||||
log.Error(err, "exechook completed with error")
|
||||
exitCode = 1
|
||||
}
|
||||
}
|
||||
if webhookRunner != nil {
|
||||
if err = webhookRunner.WaitForCompletion(); err != nil {
|
||||
log.Error(err, "webhook completed with error")
|
||||
exitCode = 1
|
||||
}
|
||||
}
|
||||
log.DeleteErrorFile()
|
||||
os.Exit(exitCode)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue