Discussion:
[Fab-user] Feature request - don't use cache
Shoham Peller
2014-12-10 20:14:38 UTC
Permalink
_______________________________________________
Fab-user mailing list
Fab-***@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fab-user
Brandon Whaley
2014-12-10 21:31:53 UTC
Permalink
Hey Shoham, see if env.eagerly_disconnect=True works for you:
http://docs.fabfile.org/en/1.10/usage/env.html?highlight=eagerly_disconnect#eagerly-disconnect
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
______________________________________________________________________________________________________________________________________________________________
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
https://lists.nongnu.org/mailman/listinfo/fab-user
Shoham Peller
2014-12-10 22:11:22 UTC
Permalink
_______________________________________________
Fab-user mailing list
Fab-***@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fab-user
Ronan Amicel
2014-12-12 13:36:53 UTC
Permalink
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
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
______________________________________________________________________________________________________________________________________________________________
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
https://lists.nongnu.org/mailman/listinfo/fab-user
Shoham Peller
2014-12-14 19:58:43 UTC
Permalink
_______________________________________________
Fab-user mailing list
Fab-***@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fab-user

Loading...