Hi Shoham,
In this situation, I typically manually clear the cache :
from fabric.state import connections
def clear_fabric_cache():
if env.host_string in connections:
connections[env.host_string].close()
del connections[env.host_string]
Hope this helps,
Ronan
On Wed, Dec 10, 2014 at 9:14 PM, Shoham Peller <[email protected]> wrote:
>
> Hello everyone,
>
> Thank you for building and maintaining such useful and well-done code
> package.
>
> I'm using fabric to connect to my virtual machines.
> But every time I'm reverting a machine, fabric fails because it caches
> it's connections (see traceback at the bottom)
>
> If I'm to explain by the code, in fabric/network.py, line 158, fabric
> checks if a connection to the requested address was already made, use that
> same session.
> But if my VM was reverted, the session is not synced and I need fabric to
> re-connect.
>
> So is there a way to force fabric to ignore or empty the cache, or maybe
> to try again if the connection was unsuccessful?
>
> Thank you all again,
> Shoham
>
>
> ______________________________________________________________________________________________________________________________________________________________
>
> Traceback (most recent call last):
> File "/home/shoham/main.py", line 80, in <module>
> main()
> File "/home/shoham/main.py", line 68, in main
> execute(task)
> File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 424,
> in execute
> results['<local-only>'] = task.run(*args, **new_kwargs)
> File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 174,
> in run
> return self.wrapped(*args, **kwargs)
> File "/home/shoham/test_mockup.py", line 11, in test_with_file_upload
> put("/home/shoham/Vagrantfile", "/tmp")
> File "/usr/local/lib/python2.7/dist-packages/fabric/network.py", line
> 647, in host_prompting_wrapper
> return func(*args, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/fabric/operations.py", line
> 346, in put
> ftp = SFTP(env.host_string)
> File "/usr/local/lib/python2.7/dist-packages/fabric/sftp.py", line 30,
> in __init__
> self.ftp = connections[host_string].open_sftp()
> File "/usr/local/lib/python2.7/dist-packages/paramiko/client.py", line
> 379, in open_sftp
> return self._transport.open_sftp_client()
> File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py",
> line 811, in open_sftp_client
> return SFTPClient.from_transport(self)
> File "/usr/local/lib/python2.7/dist-packages/paramiko/sftp_client.py",
> line 127, in from_transport
> max_packet_size=max_packet_size)
> File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py",
> line 615, in open_session
> max_packet_size=max_packet_size)
> File "/usr/local/lib/python2.7/dist-packages/paramiko/transport.py",
> line 696, in open_channel
> raise SSHException('SSH session not active')
> paramiko.ssh_exception.SSHException: SSH session not active
>
> _______________________________________________
> Fab-user mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/fab-user
>
>
_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user