X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Fssh.py;h=961f7e2ee80fd741d8bbd50a094cca046cfd3817;hb=refs%2Fchanges%2F28%2F5728%2F71;hp=3a2c1b661a8546639b7790ffd3f8a1983c4c03c9;hpb=4d9b95cde48fe1b9abf70a5c7c2edcdb3199776d;p=csit.git diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py index 3a2c1b661a..961f7e2ee8 100644 --- a/resources/libraries/python/ssh.py +++ b/resources/libraries/python/ssh.py @@ -220,7 +220,7 @@ class SSH(object): chan.set_combine_stderr(True) buf = '' - while not buf.endswith(':~$ '): + while not buf.endswith((":~$ ", "~]$ ")): try: chunk = chan.recv(self.__MAX_RECV_BUF) if not chunk: @@ -265,7 +265,9 @@ class SSH(object): except socket.timeout: raise Exception('Socket timeout: {0}'.format(buf)) tmp = buf.replace(cmd.replace('\n', ''), '') - return tmp.replace(prompt, '') + for p in prompt: + tmp.replace(p, '') + return tmp @staticmethod def interactive_terminal_close(chan): @@ -283,7 +285,7 @@ class SSH(object): logger.trace('SCP {0} to {1}:{2}'.format( local_path, self._ssh.get_transport().getpeername(), remote_path)) # SCPCLient takes a paramiko transport as its only argument - scp = SCPClient(self._ssh.get_transport()) + scp = SCPClient(self._ssh.get_transport(), socket_timeout=10) start = time() scp.put(local_path, remote_path) scp.close()