From b4d6845ee37397d5c630cf5798873b28129ba8d7 Mon Sep 17 00:00:00 2001 From: sstringer Date: Fri, 15 Jul 2022 20:13:50 +0100 Subject: [PATCH 1/2] Added more debugging when multi hosts are discovered in the callback --- cmd/PutFunctions.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/PutFunctions.go b/cmd/PutFunctions.go index f582387..ee2ea8b 100644 --- a/cmd/PutFunctions.go +++ b/cmd/PutFunctions.go @@ -55,7 +55,9 @@ func (cbl *CallbackListener) HandleResult(CheckID string, wg *sync.WaitGroup) { case clbk.Event == "execution_completed": /*We only expect one host, make sure that's all we have*/ if len(clbk.Payload.Hosts) != 1 { - log.Fatal("More than 1 host in the returned payload. This is unexpected") + log.Error("More than 1 host in the returned payload. This is unexpected. Dumping JSON") + clbk.Print() + log.Fatal("Expected only one host in the callback but got %d. Rodent doesn't currently handle this", len(clbk.Payload.Hosts)) } /*Ensure the host was reachable*/ if !clbk.Payload.Hosts[0].Reachable { From fafc824982712453167650f74e67fc7316ef939e Mon Sep 17 00:00:00 2001 From: sstringer Date: Fri, 15 Jul 2022 20:19:13 +0100 Subject: [PATCH 2/2] Fixed incorrect use of log.Fatal --- cmd/PutFunctions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/PutFunctions.go b/cmd/PutFunctions.go index ee2ea8b..3f28ca3 100644 --- a/cmd/PutFunctions.go +++ b/cmd/PutFunctions.go @@ -57,7 +57,7 @@ func (cbl *CallbackListener) HandleResult(CheckID string, wg *sync.WaitGroup) { if len(clbk.Payload.Hosts) != 1 { log.Error("More than 1 host in the returned payload. This is unexpected. Dumping JSON") clbk.Print() - log.Fatal("Expected only one host in the callback but got %d. Rodent doesn't currently handle this", len(clbk.Payload.Hosts)) + log.Fatalf("Expected only one host in the callback but got %d. Rodent doesn't currently handle this", len(clbk.Payload.Hosts)) } /*Ensure the host was reachable*/ if !clbk.Payload.Hosts[0].Reachable {