04-11-2016 02:38 AM
I am writing an EEM script that is supposed to remove itself under certain conditions. While it is able to remove itself, doing so generates an error.
As an illustration, I've tested a bare-bone TCL EEM policy called remove_me.tcl whose only goal is to remove itself:
::cisco::eem::event_register_none queue_priority low nice 1 maxrun 600
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
if {[catch {cli_open} result]} {
error "!!! error: $result" $errorInfo
} else {
array set cli $result
}
if {[catch {cli_exec $cli(fd) "enable"} result]} {
error "!!! error: $result" $errorInfo
}
if {[catch {cli_exec $cli(fd) "configure terminal"} result]} {
error "!!! error: $result" $errorInfo
}
if {[catch {cli_exec $cli(fd) "no event manager policy remove_me.tcl"} result]} {
error "!!! error: $result" $errorInfo
}
cli_close $cli(fd) $cli(tty_id)
The error message is show below:
cisco1841#error reading the channel: Process Forced Exit- policy terminated by the clear command.
while executing
"cli_exec $cli(fd) "no event manager policy remove_me.tcl""
invoked from within
"$slave eval $Contents"
(procedure "eval_script" line 7)
invoked from within
"eval_script slave $scriptname"
invoked from within
"if {$security_level == 1} { #untrusted script
interp create -safe slave
interp share {} stdin slave
interp share {} stdout slave
..."
(file "tmpsys:/lib/tcl/base.tcl" line 50)
Tcl policy execute failed: !!! error: error reading the channel: Process Forced Exit- policy terminated by the clear command.
This is also reflected in the event manager history log:
cisco1841#sh event manager history events
No. Job Id Proc Status Time of Event Event Type Name
1 62 Actv abort Tue Apr12 17:11:03 2016 none script: remove_me.tcl
Is it possible to write a self-removing EEM script that doesn't generate the error message?
Solved! Go to Solution.
04-11-2016 10:29 AM
This was fixed in relatively new versions of IOS. You must be running an older version of code. I think anything 15.x should have this fix.
04-11-2016 10:29 AM
This was fixed in relatively new versions of IOS. You must be running an older version of code. I think anything 15.x should have this fix.
04-11-2016 11:43 PM
Thank you for answering. Yes, I have confirmed the affected router is running a 12.4 image. Is there a workaround if upgrading the system image isn't an option?
04-12-2016 08:02 AM
Unfortunately, there isn't a workaround for this.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: