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.
pull/35579/head
Ganesh Nalawade 7 years ago committed by GitHub
parent dc35baa8db
commit 311918828f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save