X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Fssh.py;h=6914d528d6f8e48ff7f8a6af05d765c566fecd13;hp=a94eec4e914944628a4962654e6951f8f036a10c;hb=8f77a1ac982b07802f0fb209f589708c27f3e9c5;hpb=bea34e37b99cd3312dfb5733edea7586fbc8e1c6 diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py index a94eec4e91..6914d528d6 100644 --- a/resources/libraries/python/ssh.py +++ b/resources/libraries/python/ssh.py @@ -10,6 +10,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import socket import paramiko from paramiko import RSAKey import StringIO @@ -95,11 +96,17 @@ class SSH(object): self._ssh.get_transport().getpeername(), end-start)) stdout = "" - while True: - buf = chan.recv(self.__MAX_RECV_BUF) - stdout += buf - if not buf: - break + try: + while True: + buf = chan.recv(self.__MAX_RECV_BUF) + stdout += buf + if not buf: + break + except socket.timeout: + logger.error('Caught timeout exception, current contents ' + 'of buffer: {0}'.format(stdout)) + raise + stderr = "" while True: