Bug #142
disconnect_all doesnt delete closed connection from connections cache
| Status: | New | Start: | 02/10/2010 | |
| Priority: | Quick | Due date: | ||
| Assigned to: | % Done: | 0% |
||
| Category: | Network | |||
| Target version: | 1.0 | |||
Description
hi,
i use fabric version 1.0a.
after a network.disconnect_all() the connections cache is not empty. if you call run (or something similar) again it is raise an exception:
@needs_host def run(command, shell=True, pty=False): """ Run a shell command on a remote host. If ``shell`` is True (the default), `run` will execute the given command string via a shell interpreter, the value of which may be controlled by setting ``env.shell`` (defaulting to something similar to ``/bin/bash -l -c "<command>"``.) Any double-quote (``"``) or dollar-sign (``$``) characters in ``command`` will be automatically escaped when ``shell`` is True. `run` will return the result of the remote program's stdout as a single (likely multiline) string. This string will exhibit ``failed`` and ``succeeded`` boolean attributes specifying whether the command failed or succeeded, and will also include the return code as the ``return_code`` attribute. Standard error will also be attached, as a string, to this return value as the ``stderr`` attribute. You may pass ``pty=True`` to force allocation of a pseudo tty on the remote end. This is not normally required, but some programs may complain (or, even more rarely, refuse to run) if a tty is not present. Examples:: run("ls /var/www/") run("ls /home/myuser", shell=False) output = run('ls /var/www/site1') .. versionchanged:: 1.0 Added the ``succeeded`` attribute. .. versionchanged:: 1.0 Added the ``stderr`` attribute. """return _run_command(command, shell, pty)/usr/local/lib/python2.6/dist-packages/Fabric-1.0a-py2.6.egg/fabric/operations.py:567:
command = ‘cat /etc/deskcloudclient/config.cfg’, shell = True, pty = False sudo = False, user = None
def _run_command(command, shell=True, pty=False, sudo=False, user=None): """ Underpinnings of `run` and `sudo`. See their docstrings for more info. """ # Set up new var so original argument can be displayed verbatim later. given_command = command # Handle context manager modifications, and shell wrapping wrapped_command = _shell_wrap( _prefix_commands(_prefix_env_vars(command)), shell, _sudo_prefix(user) if sudo else None ) which = 'sudo' if sudo else 'run' if output.debug: print("[%s] %s: %s" % (env.host_string, which, wrapped_command)) elif output.running: print("[%s] %s: %s" % (env.host_string, which, given_command))channel = connections[env.host_string]._transport.open_session()E AttributeError: ‘NoneType’ object has no attribute ‘open_session’
/usr/local/lib/python2.6/dist-packages/Fabric-1.0a-py2.6.egg/fabric/operations.py:484: AttributeError
History
Updated by Jeff Forcier 169 days ago
- Priority changed from Normal to Quick
Thanks for the catch, interesting bug. Should be easily fixable.
Also available in: Atom