05-22-2018 12:45 AM - edited 03-01-2019 06:36 PM
Hello,
I am trying to install a cat9k_iosxe.16.06.03.SPA.bin image with guestshell (ZTP - Python),
I have this message:
"% Interactive command can not execute in non-interactive context"
! here is the command:
install_cmd = "request platform software package install switch all flash: cat9k_iosxe.16.06.03.SPA.bin auto-copy"
cli.executep (install_cmd)
Nota: The execution of the command in privileged EXEC mode is correctly executed and without confirmation message (non interactive)
Thank you for your help.
Solved! Go to Solution.
05-22-2018 12:23 PM
Even if the command does not prompt, it may be marked interactive. I'd generally consider that a bug. To workaround this, you can use EEM to wrap the command:
event manager applet upgrade
event none maxrun 300
action 1.0 cli command "enable"
action 2.0 cli command "request platform software package install switch all flash: cat9k_iosxe.16.06.03.SPA.bin auto-copy"
Then:
install_cmd = "event manager run upgrade"
05-22-2018 12:23 PM
Even if the command does not prompt, it may be marked interactive. I'd generally consider that a bug. To workaround this, you can use EEM to wrap the command:
event manager applet upgrade
event none maxrun 300
action 1.0 cli command "enable"
action 2.0 cli command "request platform software package install switch all flash: cat9k_iosxe.16.06.03.SPA.bin auto-copy"
Then:
install_cmd = "event manager run upgrade"
05-23-2018 11:20 PM
Hi, it works with EEM, thank you Joe
Nota : install_cmd = ....switch all FILE flash:......
04-09-2020 02:27 AM
Could you please share some code examples how to use the event manager in this case?
04-09-2020 07:46 AM
The example here already is an example using EEM (the EEM applet). I'm not sure what you're looking for specifically.
04-11-2020 01:35 AM
Joe's example shows how to use eem
python :
eem = '''event manager applet upgrade
event none maxrun 300
action 1.0 cli command "enable"
action 2.0 cli command "request platform software package install switch all file flash: cat9k_iosxe.16.06.03.SPA.bin auto-copy" '''
cli.configurep(eem)
install_cmd = "event manager run upgrade"
cli.executep (install_cmd)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide