[Bro-Dev] #920: Have broctl return useful exit codes

Bro Tracker bro at tracker.bro-ids.org
Mon Dec 10 09:51:36 PST 2012


#920: Have broctl return useful exit codes
-------------------------+------------------------
  Reporter:  grigorescu  |      Owner:
      Type:  Patch       |     Status:  new
  Priority:  Normal      |  Milestone:  Bro2.2
 Component:  BroControl  |    Version:  git/master
Resolution:              |   Keywords:
-------------------------+------------------------

Comment (by grigorescu):

 Replying to [comment:1 robin]:
 > Haven't looked at the code yet but I'm wondering about the right
 semantics for a non-zero code. Intuitively I'd expect non-zero if the
 command had seriously failed but it's a bit fuzzy when a command succeeded
 vs. failed; if {{{start}}} started up the whole cluster except for one
 node which is currently down, is that a failure? What semantics is the
 patch currently using?

 To me, the interpretation of the exit code for broctl is "was the result
 of the command what the documentation says *should have* happened?" So,
 for the case you listed, when I run start, I expect Bro to start all the
 nodes. If one of the nodes didn't start, the command didn't execute as
 expected.

 The one exception for this is status - based on the above definition, the
 exit code should only signify whether or not broctl was able to determine
 the status of all the nodes. However, I think it makes sense to keep
 status in line with most status commands, that return 0 if everything is
 ok, and 1 otherwise.

 My incentive for writing this was to create a Puppet module for Bro. All
 that really needs is for status to return the proper exit code. If that
 seems like a reasonable change, I can make a commit just for status, until
 the rest of the commands can be further discussed.

 > Plugins have the {{{hostStatusChanged}}} method. Would that help as an
 alternative?

 That only seems to reflect the availability of a system, and doesn't tell
 you anything about the status of the nodes running on that system. I don't
 think that's quite what I'm looking for.

-- 
Ticket URL: <http://tracker.bro-ids.org/bro/ticket/920#comment:2>
Bro Tracker <http://tracker.bro-ids.org/bro>
Bro Issue Tracker



More information about the bro-dev mailing list