cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1183
Views
0
Helpful
3
Replies

Error message from self removing EEM script

sagewwder
Level 1
Level 1

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?

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

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.

View solution in original post

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

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.

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?

Unfortunately, there isn't a workaround for this.

Getting Started

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: