From ac257c7a6d48ecd67cacc48e89f0105c89dcbe11 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Wed, 10 Aug 2011 16:29:52 -0500 Subject: [PATCH] Change/fix some cluster script error reporting. The main script now uses the Reporter::error BIF instead of scheduling a reporter_error event to report an invalid node name. The later only works if the reporter framework is loaded, but the BIF will do the right thing and use stderr if there's no event handler. I also @if'd out most of the setup-connections script when the node is invalid because that's what the cluster/__load__.bro would normally do. --- scripts/base/frameworks/cluster/main.bro | 3 +-- scripts/base/frameworks/cluster/setup-connections.bro | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/base/frameworks/cluster/main.bro b/scripts/base/frameworks/cluster/main.bro index 7b277769fb..4817db0ea7 100644 --- a/scripts/base/frameworks/cluster/main.bro +++ b/scripts/base/frameworks/cluster/main.bro @@ -60,8 +60,7 @@ event bro_init() # If a node is given, but it's an unknown name we need to fail. if ( node != "" && node !in nodes ) { - local msg = "You didn't supply a valid node in the Cluster::nodes configuration."; - event reporter_error(current_time(), msg, ""); + Reporter::error(fmt("'%s' is not a valid node in the Cluster::nodes configuration", node)); terminate(); } diff --git a/scripts/base/frameworks/cluster/setup-connections.bro b/scripts/base/frameworks/cluster/setup-connections.bro index 956a6194f4..b0d833d362 100644 --- a/scripts/base/frameworks/cluster/setup-connections.bro +++ b/scripts/base/frameworks/cluster/setup-connections.bro @@ -1,6 +1,8 @@ @load ./main @load base/frameworks/communication/main +@if ( Cluster::node in Cluster::nodes ) + module Cluster; event bro_init() &priority=9 @@ -80,3 +82,5 @@ event bro_init() &priority=9 } } } + +@endif