[PATCH] KVM test: Fix problem when unexpected strings appear on SSH prompt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In some conditions, ssh may respond things like:

Warning: Permanently added localhost' (RSA) to the list of known hosts.

Take that into account on the remote login function.

Signed-off-by: Jason D. Gaston <jason.d.gaston@xxxxxxxxx>
---
 client/virt/virt_utils.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py
index 8fa64ca..398ecd4 100644
--- a/client/virt/virt_utils.py
+++ b/client/virt/virt_utils.py
@@ -557,7 +557,7 @@ def _remote_login(session, username, password, prompt, timeout=10):
             match, text = session.read_until_last_line_matches(
                 [r"[Aa]re you sure", r"[Pp]assword:\s*$", r"[Ll]ogin:\s*$",
                  r"[Cc]onnection.*closed", r"[Cc]onnection.*refused",
-                 r"[Pp]lease wait", prompt],
+                 r"[Pp]lease wait", r"[Ww]arning", prompt],
                 timeout=timeout, internal_timeout=0.5)
             if match == 0:  # "Are you sure you want to continue connecting"
                 logging.debug("Got 'Are you sure...'; sending 'yes'")
@@ -592,7 +592,10 @@ def _remote_login(session, username, password, prompt, timeout=10):
                 logging.debug("Got 'Please wait'")
                 timeout = 30
                 continue
-            elif match == 6:  # prompt
+            elif match == 6:  # "Warning added RSA"
+                logging.debug("Got 'Warning added RSA to known host list")
+                continue
+            elif match == 7:  # prompt
                 logging.debug("Got shell prompt -- logged in")
                 break
         except aexpect.ExpectTimeoutError, e:
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux