X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=resources%2Flibraries%2Fpython%2Fssh.py;h=6914d528d6f8e48ff7f8a6af05d765c566fecd13;hb=8f77a1ac982b07802f0fb209f589708c27f3e9c5;hp=a94eec4e914944628a4962654e6951f8f036a10c;hpb=2bd0f8299dffb7818d87081f2f7b06d38a8ab620;p=csit.git 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: