简体   繁体   中英

How to answer Yes and No question paramiko

I need to save configuration on switch extreme. The command is:

save configuration "File Name"

After of command's execution i need to answer 2 question.

First:

Do you want to save configuration? (y/N) -> I have to say Yes

Second:

Do you want to make "File Name".cfg the default database? (y/N) -> I have to say No

I am using paramiko for command execution.

Below is a piece of my code:

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(server, username=username, password=password)
stdin, stdout, stderr = ssh.exec_command('save configuration '+ backupFileName)
#Now i need to say first Yes and then NO

Someone could help me?

Thanks

Try this: stdin, stdout, stderr = ssh.exec_command(f'save configuration {backupFileName};yes;no')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM