From 6775c14e5eec27068c64f135741d206b2b314e16 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Wed, 28 Apr 2021 01:06:30 -0500 Subject: [PATCH] Fix order of logging calls in handler startup code (#733) 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 --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 4f5f61216..258add15e 100644 --- a/main.go +++ b/main.go @@ -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 @@ -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) } }