MCPcopy Create free account
hub / github.com/StackStorm/st2 / SSHCommandTimeoutError

Class SSHCommandTimeoutError

st2common/st2common/runners/paramiko_ssh.py:47–82  ·  view source on GitHub ↗

Exception which is raised when an SSH command times out.

Source from the content-addressed store, hash-verified

45
46
47class SSHCommandTimeoutError(Exception):
48 """
49 Exception which is raised when an SSH command times out.
50 """
51
52 def __init__(self, cmd, timeout, ssh_connect_timeout, stdout=None, stderr=None):
53 """
54 :param stdout: Stdout which was consumed until the timeout occured.
55 :type stdout: ``str``
56
57 :param stdout: Stderr which was consumed until the timeout occured.
58 :type stderr: ``str``
59 """
60 self.cmd = cmd
61 self.timeout = timeout
62 self.ssh_connect_timeout = ssh_connect_timeout
63 self.stdout = stdout
64 self.stderr = stderr
65 self.message = (
66 "Command didn't finish in %s seconds or the SSH connection "
67 "did not succeed in %s seconds" % (timeout, ssh_connect_timeout)
68 )
69 super(SSHCommandTimeoutError, self).__init__(self.message)
70
71 def __repr__(self):
72 return (
73 '<SSHCommandTimeoutError: cmd="%s", timeout=%s, ssh_connect_timeout=%s)>'
74 % (
75 self.cmd,
76 self.timeout,
77 self.ssh_connect_timeout,
78 )
79 )
80
81 def __str__(self):
82 return self.message
83
84
85class ParamikoSSHClient(object):

Callers 2

runMethod · 0.85

Calls

no outgoing calls

Tested by 1