cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4483
Views
5
Helpful
5
Replies

CAT9K_IOSXE Guestshell ZTP - Python / cmd can not execute in non-interactive context

cisco.13
Level 1
Level 1

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.

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

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"

View solution in original post

5 Replies 5

Joe Clarke
Cisco Employee
Cisco Employee

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"

Hi, it works with EEM, thank you Joe

Nota : install_cmd = ....switch all FILE flash:......

Could you please share some code examples how to use the event manager in this case?

The example here already is an example using EEM (the EEM applet).  I'm not sure what you're looking for specifically.

 

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)