fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] How to properly use interactive prompts


From: Brandon Whaley
Subject: Re: [Fab-user] How to properly use interactive prompts
Date: Thu, 26 Jun 2014 20:51:03 -0400

Hi Justin,

In your example code, you're setting a local variable named prompts.  Try setting env.prompts instead.


On Thu, Jun 26, 2014 at 11:30 AM, Justin Polidora <address@hidden> wrote:
Hi,

I am using Fabric 1.9 and am trying to control an interactive prompt from a bash script.  According to the Fabric documentation and GitHub tickets #741 & #1021, there is support to send interactive responses with the prompts dictionary object.  The documentation at http://docs.fabfile.org/en/latest/usage/env.html#prompts is unclear about describing how to use prompts in conjunction with the run() method.  I am trying to send an interactive response to a remote command.

I tried defining the prompts dictionary and using it in the following way:

def runcommand():
     # I understand that the dict keys are the stdout text to expect and the corresponding dict values are the text to send on stdin to satisfy the waiting bash script's prompt
     prompts = {"Are you sure you want to continue (yes/no)?": "yes"}
     run(bash_script)

tests/test_io.py has the only code example that sort of explains the prompts dictionary usage, but overriding the run method as described there does not achieve the desired behavior.  Shouldn't interactive prompts work without having to override run()?  I have only a beginner regarding Fabric, but I would greatly appreciate any guidance in this matter. 

Thank you,
Justin

_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user



reply via email to

[Prev in Thread] Current Thread [Next in Thread]