Fix double prompt issue in network_cli (#35439)
Fixes #33993 In current implementation while trying to fetch the current cli prompt terminal plugin executes `\r` on remote host. This causes if command execution results in a prompt for example executing `enable` command results in `Password:` prompt there by executing `\r` on password prompt which is not intended. To fix it while fetching current prompt from terminal plugin use `get_prompt()` api in network_cli that returns the latest matched prompt instead of unnecessary executing `\r` on remote host.
This commit is contained in:
parent
dc35baa8db
commit
311918828f
1 changed files with 1 additions and 5 deletions
|
@ -69,11 +69,7 @@ class TerminalBase(with_metaclass(ABCMeta, object)):
|
|||
|
||||
:returns: A byte string of the prompt
|
||||
"""
|
||||
# do not send '\n' here, exec_cli_command sends '\r' already,
|
||||
# doing so causes double prompts.
|
||||
self._exec_cli_command(b'')
|
||||
|
||||
return self._connection._matched_prompt
|
||||
return self._connection.get_prompt()
|
||||
|
||||
def on_open_shell(self):
|
||||
"""Called after the SSH session is established
|
||||
|
|
Loading…
Reference in a new issue