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.
This commit is contained in:
Jon Siwek 2011-08-10 16:29:52 -05:00
parent 9e7934dc32
commit ac257c7a6d
2 changed files with 5 additions and 2 deletions

View file

@ -60,8 +60,7 @@ event bro_init()
# If a node is given, but it's an unknown name we need to fail. # If a node is given, but it's an unknown name we need to fail.
if ( node != "" && node !in nodes ) if ( node != "" && node !in nodes )
{ {
local msg = "You didn't supply a valid node in the Cluster::nodes configuration."; Reporter::error(fmt("'%s' is not a valid node in the Cluster::nodes configuration", node));
event reporter_error(current_time(), msg, "");
terminate(); terminate();
} }

View file

@ -1,6 +1,8 @@
@load ./main @load ./main
@load base/frameworks/communication/main @load base/frameworks/communication/main
@if ( Cluster::node in Cluster::nodes )
module Cluster; module Cluster;
event bro_init() &priority=9 event bro_init() &priority=9
@ -80,3 +82,5 @@ event bro_init() &priority=9
} }
} }
} }
@endif