fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] fabric as library, access pool of connections indexed by


From: Brandon Whaley
Subject: Re: [Fab-user] fabric as library, access pool of connections indexed by host
Date: Fri, 21 Mar 2014 19:12:34 -0400

Hey Jon,

Fabric doesn't actually make multiple connections, it reuses them:

http://docs.fabfile.org/en/1.8/usage/execution.html?highlight=cache#connections

The live connections are stored inĀ fabric.state.connections for the life of your program run (I believe, feel free to correct me if I'm wrong there).


On Fri, Mar 21, 2014 at 7:07 PM, Jon Mansey <address@hidden> wrote:
Hello, my application requries opening ssh connections to a list of hosts (typically less than 10), then performing different commands on each and parsing the output. So I need a way to programatically address the ssh commands sent to the correct host. eg execute command x on host y. However I dont want to open a new connection and log in each time a command is needed, I want it to log in when first needed and keep the session open for future use.

it seems fabric's execute command should be able to do this but perhaps im just missing that there is a far simpler way of making an ssh class that can be called with a command and an index for host?

so id like to do something like this

env.hosts = [host1, host2, host3]

execute(command1, host1)

execute(commandm, hostn)


Am I on the right track here? Are there any code examples available for this use-case?

Thanks

Jon
_______________________________________________
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]