Skip to content

Commit

Permalink
Fixed login prompt issue as couple of system has new login prompt
Browse files Browse the repository at this point in the history
added wildcard as :~ as , in couple of system op-test error out as not get exact wild card

Signed-off-by: Praveen K Pandey <[email protected]>
  • Loading branch information
PraveenPenguin committed May 14, 2024
1 parent 417e57e commit 2a1f805
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions common/OpTestUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 2a1f805

Please sign in to comment.