From 2a1f805da1dc42522826a569b7a7f038f41d6c5b Mon Sep 17 00:00:00 2001 From: Praveen K Pandey Date: Tue, 14 May 2024 11:16:52 +0530 Subject: [PATCH] Fixed login prompt issue as couple of system has new login prompt added wildcard as :~ as , in couple of system op-test error out as not get exact wild card Signed-off-by: Praveen K Pandey --- common/OpTestUtil.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/OpTestUtil.py b/common/OpTestUtil.py index 03e2d5676..f386edd9c 100644 --- a/common/OpTestUtil.py +++ b/common/OpTestUtil.py @@ -1484,9 +1484,9 @@ def get_login(self, host, term_obj, pty, prompt): if rc == 0: pty.sendline(my_pwd) time.sleep(0.5) - rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", + rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", ":~", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=60) - if rc not in [1, 2, 3, 4]: + if rc not in [1, 2, 3, 4, 5]: if term_obj.setup_term_quiet == 0: log.warning("OpTestSystem Problem with the login and/or password prompt," " raised Exception ConsoleSettings but continuing") @@ -1518,9 +1518,9 @@ def get_login(self, host, term_obj, pty, prompt): if rc == 0: pty.sendline(my_pwd) time.sleep(0.5) - rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", + rc = pty.expect(['login: $', ".*#$", ".*# $", ".*\$", "~ #", ":~", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10) - if rc not in [1, 2, 3, 4]: + if rc not in [1, 2, 3, 4, 5]: if term_obj.setup_term_quiet == 0: log.warning("OpTestSystem Problem with the login and/or password prompt," " raised Exception ConsoleSettings but continuing") @@ -1688,14 +1688,14 @@ def setup_term(self, system, pty, ssh_obj=None, block=0): # Ctrl-L may cause a esc[J (erase) character to appear in the buffer. # Include this in the patterns that expect $ (end of line) rc = pty.expect(['login: (\x1b\[J)*$', ".*#(\x1b\[J)*$", ".*# (\x1b\[J)*$", ".*\$(\x1b\[J)*", - "~>(\x1b\[J)", "~ #(\x1b\[J)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10) + "~>(\x1b\[J)", "~ #(\x1b\[J)", ":~(\x1b\[J)", 'Petitboot', pexpect.TIMEOUT, pexpect.EOF], timeout=10) if rc == 0: track_obj.PS1_set, track_obj.LOGIN_set = self.get_login( system_obj.cv_HOST, term_obj, pty, self.build_prompt(system_obj.prompt)) track_obj.PS1_set, track_obj.SUDO_set = self.get_sudo( system_obj.cv_HOST, term_obj, pty, self.build_prompt(system_obj.prompt)) return - if rc in [1, 2, 3, 4, 5]: + if rc in [1, 2, 3, 4, 5, 6]: track_obj.LOGIN_set = track_obj.PS1_set = self.set_PS1( term_obj, pty, self.build_prompt(system_obj.prompt)) track_obj.PS1_set, track_obj.SUDO_set = self.get_sudo(