This is related to this question here, but with a slight twist: instead of just passing 'yes' or 'no', I need Fabric to pass an arbitrary string to the remote shell.
For instance, if the remote shell prompts for 'what is your name?' then I need to feed it 'first,last'.
Clarification: I know I said arbitrary input, but I was really trying to use it for the SSH key passwd prompt when I try to do a git pull.
Update #1: Got a response from Jeff Forcier @bitprophet
that’s like the #1 wart right now :( Either tunnelling to send a key agent out-of-band, or remote prompting, is needed.
I meant adding support for those things in Fabric, is what we need to do to get network-borne git ops working
Adding an easy way to kick off an OOB ssh agent-friendly tunnel is going to be easier/faster, most likely. Soon probably
I have proposed an API for this feature in fabric on the mailinglist, and ended up writing something myself:
from fexpect import expect, expecting, run
prompts = []
prompts += expect('What is your name?','John')
prompts += expect('Where do you live?','New York')
with expecting(prompts):
run('command')
See my blogpost on expecting prompts in fabric with fexpect
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With