I have two problems I am trying to solve with fabric for python.
- I'd like to auto-enter the password at the prompt:
- I'd like to auto-respond to prompts based on the output of a session:
Both of these should be possible as the above links show, but I can't get them to work. When I run the following file via fab test
from fabric.api import run, env, settings
env.hosts = ['<user>@<host>']
env.passwords = {'<user>@<host>': '<password>'}
def test():
with settings(prompts={"Please select a menu item: ": "1",}):
return
run("ls")
My output is:
[<user>@<host>] Login password for '<user>':
At which point I have to type my password, instead of auto-entering. Then per the remote host I get a menu which I want to auto respond to, but my prompt's auto-complete doesn't work.
[<user>@<host>] out: <a menu>
[<user>@<host>] out: Please select a menu item:
What do I need to do to get this to auto-enter my password and auto-answer this prompt?