From: Lucas Meneghel Rodrigues Subject: [PATCH] KVM test: Fix problem when unexpected strings appear on SSH prompt Date: Fri, 29 Apr 2011 01:15:46 -0300 Message-ID: <1304050546-6472-1-git-send-email-lmr@redhat.com> Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues , "Jason D. Gaston" To: autotest@test.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:45831 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750833Ab1D2EPw (ORCPT ); Fri, 29 Apr 2011 00:15:52 -0400 Sender: kvm-owner@vger.kernel.org List-ID: 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 --- 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