...
EEM applet which contains escaped quotes fails on reload, EEM applet gets messed up
IF EEM applet has a variable, cli-command, with an escaped quotation, then on reload this error will happen
1. Create an environment variable for " Router(config)#event manager environment dblquote " 2. The above environment variable will be saved into running-config and startup-config Router#show running-config | sec dblquote event manager environment dblquote " Router#show startup-config | sec dblquote event manager environment dblquote " 3. Create applet using environment variable instead of double quote. event manager applet testApplet event none action 005 syslog msg "testApplet applet in progress" action 010 cli command "enable" action 020 set testString "Running with escaped quotes $dblquote escaped string $dblquote " action 030 syslog msg "Printing testString [$testString]" end 4. Above Applet will be saved to running-config and startup-config with $dblquote Router#show running-config | sec testApplet event manager applet testApplet event none action 005 syslog msg "testApplet applet in progress" action 010 cli command "enable" action 020 set testString "Running with escaped quotes $dblquote escaped string $dblquote " action 030 syslog msg "Printing testString [$testString]" Router#show startup-config | sec testApplet event manager applet testApplet event none action 005 syslog msg "testApplet applet in progress" action 010 cli command "enable" action 020 set testString "Running with escaped quotes $dblquote escaped string $dblquote " action 030 syslog msg "Printing testString [$testString]" 5. After running the event manually the $dblquote variable replaced with " in the logs. Router#event manager run testApplet Router# *Mar 20 08:14:45.308: %HA_EM-6-LOG: testApplet: testApplet applet in progress *Mar 20 08:14:45.419: %HA_EM-6-LOG: testApplet: Printing testString [Running with escaped quotes " escaped string " ]
Add an EEM applet which contains escaped characters: conf t event manager applet testApplet event none action 005 syslog msg "testApplet applet in progress" action 010 cli command "enable" action 020 set testString "Running with escaped quotes \"escaped string\"" action 030 syslog msg "Printing testString [$testString]" end It gets saved to the device's running config fine, as shown below: Router#show run | sec testApplet event manager applet testApplet event none action 005 syslog msg "testApplet applet in progress" action 010 cli command "enable" action 020 set testString "Running with escaped quotes "escaped string"" action 030 syslog msg "Printing testString [$testString]" Router# and it runs fine: Router# *Feb 2 21:03:36.217: %HA_EM-6-LOG: testApplet: testApplet applet in progress *Feb 2 21:03:36.330: %HA_EM-6-LOG: testApplet: Printing testString [Running with escaped quotes "escaped string"] Router# BUT during device reload, the non escaped strings from start-up-config cause invalid input error: 2766848K bytes of Bootflash at bootflash:. action 020 set testString "Running with escaped quotes "escaped string"" ^ % Invalid input detected at '^' marker. And the action 20 from EEM gets removed, making the EEM applet of no use: Router#show run | sec testApplet event manager applet testApplet event none action 005 syslog msg "testApplet applet in progress" action 010 cli command "enable" action 030 syslog msg "Printing testString [$testString]" Router# Router#event manager run testApplet Router# *Feb 2 21:08:14.884: %HA_EM-6-LOG: testApplet: testApplet applet in progress *Feb 2 21:08:15.000: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: testString *Feb 2 21:08:15.000: %HA_EM-3-FMPD_ERROR: Error executing applet testApplet statement 030