printed CEL messages to stdout when running in batch mode. Aborted current session when in batch mode and a FATAL event is received from the daemon
This commit is contained in:
parent
591ec20937
commit
3340ae2796
3 changed files with 21 additions and 5 deletions
|
@ -1480,8 +1480,13 @@ proc parseEventMessage { data len flags channel } {
|
||||||
if { $eventtype == 4 } { ;# entered the runtime state
|
if { $eventtype == 4 } { ;# entered the runtime state
|
||||||
if { $g_traffic_start_opt == 1 } { startTrafficScripts }
|
if { $g_traffic_start_opt == 1 } { startTrafficScripts }
|
||||||
if { $execMode == "batch" } {
|
if { $execMode == "batch" } {
|
||||||
global g_current_session
|
global g_current_session g_abort_session
|
||||||
puts "disconnecting. Session id is $g_current_session"
|
if {$g_abort_session} {
|
||||||
|
puts "Current session ($g_current_session) aborted. Disconnecting."
|
||||||
|
shutdownSession
|
||||||
|
} else {
|
||||||
|
puts "Session running. Session id is $g_current_session. Disconnecting."
|
||||||
|
}
|
||||||
exit.real
|
exit.real
|
||||||
}
|
}
|
||||||
} elseif { $eventtype == 6 } { ;# shutdown state
|
} elseif { $eventtype == 6 } { ;# shutdown state
|
||||||
|
|
|
@ -126,6 +126,7 @@ loadPluginsConf
|
||||||
checkCommandLineAddressPort
|
checkCommandLineAddressPort
|
||||||
autoConnectPlugins
|
autoConnectPlugins
|
||||||
|
|
||||||
|
set g_abort_session 0
|
||||||
|
|
||||||
#
|
#
|
||||||
# Initialization should be complete now, so let's start doing something...
|
# Initialization should be complete now, so let's start doing something...
|
||||||
|
@ -176,7 +177,7 @@ if {$execMode == "interactive"} {
|
||||||
after 100 {
|
after 100 {
|
||||||
loadCfg $cfg
|
loadCfg $cfg
|
||||||
deployCfgAPI $sock
|
deployCfgAPI $sock
|
||||||
puts "waiting to enter RUNTIME state..."
|
puts "Waiting to enter RUNTIME state..."
|
||||||
}
|
}
|
||||||
global vwaitdummy
|
global vwaitdummy
|
||||||
vwait vwaitdummy
|
vwait vwaitdummy
|
||||||
|
|
|
@ -12,11 +12,21 @@ set g_cel_blink_state "off"
|
||||||
|
|
||||||
# receive an exception into the g_exceptions array from an Exception Message
|
# receive an exception into the g_exceptions array from an Exception Message
|
||||||
proc receiveException { valuelist } {
|
proc receiveException { valuelist } {
|
||||||
global g_exceptions EXCEPTION_LEVELS
|
global g_exceptions EXCEPTION_LEVELS execMode
|
||||||
set idx [expr {1 + [array size g_exceptions]}]
|
set idx [expr {1 + [array size g_exceptions]}]
|
||||||
array set g_exceptions [list $idx $valuelist]
|
array set g_exceptions [list $idx $valuelist]
|
||||||
# exceptions with level ERROR or FATAL will throw the CEL
|
|
||||||
array set vals $valuelist
|
array set vals $valuelist
|
||||||
|
# print exception message on stdout if in batch mode
|
||||||
|
if { $execMode == "batch" } {
|
||||||
|
puts "\nFrom $vals(src): $vals(txt)"
|
||||||
|
|
||||||
|
# Abort the session if a fatal exception is reported
|
||||||
|
if { $vals(level) <= [lsearch -exact $EXCEPTION_LEVELS "FATAL" ] } {
|
||||||
|
global g_current_session g_abort_session
|
||||||
|
set g_abort_session 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# exceptions with level ERROR or FATAL will throw the CEL
|
||||||
if { $vals(level) <= [lsearch -exact $EXCEPTION_LEVELS "ERROR"] } {
|
if { $vals(level) <= [lsearch -exact $EXCEPTION_LEVELS "ERROR"] } {
|
||||||
throwCEL false
|
throwCEL false
|
||||||
if { $vals(level) <= [lsearch -exact $EXCEPTION_LEVELS "FATAL" ] } {
|
if { $vals(level) <= [lsearch -exact $EXCEPTION_LEVELS "FATAL" ] } {
|
||||||
|
|
Loading…
Reference in a new issue