Fix ssh prompts for centos 55/5155/6
authorMatej Klotton <mklotton@cisco.com>
Thu, 16 Feb 2017 07:18:00 +0000 (08:18 +0100)
committerMatej Klotton <mklotton@cisco.com>
Thu, 16 Feb 2017 08:42:13 +0000 (09:42 +0100)
Change-Id: I864f97b4559fc1d692bfba80266150a3d06dd6bb
Signed-off-by: Matej Klotton <mklotton@cisco.com>
resources/libraries/python/VatExecutor.py
resources/libraries/python/ssh.py

index 5f7e188..9db53d3 100644 (file)
@@ -157,8 +157,8 @@ class VatTerminal(object):
 
     """
 
-    __VAT_PROMPT = "vat# "
-    __LINUX_PROMPT = ":~$ "
+    __VAT_PROMPT = ("vat# ", )
+    __LINUX_PROMPT = (":~$ ", "~]$ ")
 
     def __init__(self, node, json_param=True):
         json_text = ' json' if json_param else ''
index 3a2c1b6..7b15998 100644 (file)
@@ -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):

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.