tags:

views:

33

answers:

1

The website says:

Closing connections: Fabric’s connection cache never closes connections itself – it leaves this up to whatever is using it. The fab tool does this bookkeeping for you: it iterates over all open connections and closes them just before it exits (regardless of whether the tasks failed or not.)

Library users will need to ensure they explicitly close all open connections before their program exits, though we plan to makes this easier in the future.

I have searched everywhere, but I can't find out how to disconnect or close the connections. I am looping through my hosts and setting env.host_string. It is working, but hangs when exiting. Any help on how to close? Just to reiterate, I am using the library, not a fabfile.

+1  A: 

Well API docs are for wimps, real men read the source code. The main.py for fabric has this:

from fabric.state import commands, connections

for key in connections.keys():
            if state.output.status:
                print "Disconnecting from %s..." %, denormalize(key), connections[key].close()

fabric.state.connections is a dict with the value being: paramiko.SSHClient

So off I go to close those.

Amala
Except API docs should still be correct.
Christopher Mahan