Exception which is raised when an SSH command times out.
| 45 | |
| 46 | |
| 47 | class 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 | |
| 85 | class ParamikoSSHClient(object): |
no outgoing calls