Skip to content

Exceptions thrown when stop_on_errors=False #121

@tiagom62

Description

@tiagom62

Bug reports

Steps to reproduce:
Using the native client run a command on a remote host that times out.

  1. Example code that produces error.
from pssh.clients import ParallelSSHClient
import os

client = ParallelSSHClient(['a.example.com', 'b.example.com'], allow_agent=False, user='ubuntu', pkey=os.path.expanduser('~/.ssh/key'), proxy_host='proxy.example.com', proxy_user='user', proxy_pkey=os.path.expanduser('~/.ssh/id_rsa'))

cmd_response = client.run_command('lsb_release -r', stop_on_errors=False, shell='bash -c')

for node in cmd_response:
    print(cmd_response[node]['host'])
  1. Stack trace or error messages.
Exception in thread Thread-360:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/tunnel.py", line 123, in run
    self._init_tunnel_client()
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/tunnel.py", line 119, in _init_tunnel_client
    timeout=self.timeout)
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/clients/native/single.py", line 120, in __init__
    THREAD_POOL.apply(self._init)
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/gevent/pool.py", line 324, in apply
    return func(*args, **kwds)
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/clients/native/single.py", line 158, in _init
    return self._connect_init_retry(retries)
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/clients/native/single.py", line 148, in _connect_init_retry
    return self._init(retries=retries)
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/clients/native/single.py", line 160, in _init
    raise SessionError(msg, self.host, self.port, ex)
SessionError: ('Error connecting to host %s:%s - %s', 'proxy.example.com', 22, Timeout())
Exception in thread Thread-17:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/tunnel.py", line 123, in run
    self._init_tunnel_client()
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/tunnel.py", line 119, in _init_tunnel_client
    timeout=self.timeout)
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/clients/native/single.py", line 119, in __init__
    self._connect(self._host, self.port)
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/clients/native/single.py", line 189, in _connect
    return self._connect(host, port, retries=retries+1)
  File "/Users/PATH_TO_APP/venv/lib/python2.7/site-packages/pssh/clients/native/single.py", line 194, in _connect
    self.num_retries,)
ConnectionErrorException: ("Error connecting to host '%s:%s' - %s - retry %s/%s", 'a.example.com', 22, 'Operation timed out', 2, 2)

Expected behaviour:
Exceptions not thrown.

Actual behaviour:
Exceptions above. I don't get this with the paramiko client.
My testing is specifically with a proxy. I did not test without a proxy.

Additional info: [Include version of ssh2-python and/or paramiko and any other relevant information.]
Parallel-ssh 1.6.1
ssh2-python 0.13.0.post2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions