Skip to content

Commit

Permalink
Fix order of logging calls in handler startup code (#733)
Browse files Browse the repository at this point in the history
The previous order of these calls resulted in the container exiting
before the log message was output, which made it impossible to debug
what went wrong. This just changes the order so the message is logged
and then the process exits.

Signed-off-by: Ben Nemec <[email protected]>
  • Loading branch information
cybertron authored Apr 28, 2021
1 parent a8d083e commit 6775c14
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ func main() {
// Check that nmstatectl is working
_, err := nmstatectl.Show()
if err != nil {
os.Exit(1)
setupLog.Error(err, "failed checking nmstatectl health")
os.Exit(1)
}

// Handler runs with host networking so opening ports is problematic
Expand All @@ -204,8 +204,8 @@ func main() {
setupLog.Info("Marking handler as healthy touching healthy file", "healthyFile", healthyFile)
err = file.Touch(healthyFile)
if err != nil {
os.Exit(1)
setupLog.Error(err, "failed marking handler as healthy")
os.Exit(1)
}
}

Expand Down

0 comments on commit 6775c14

Please sign in to comment.