From 311918828f2b3afa940ab9dde8bfd4bcfbcfc799 Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Wed, 31 Jan 2018 11:43:08 +0530 Subject: [PATCH] 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. --- lib/ansible/plugins/terminal/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/ansible/plugins/terminal/__init__.py b/lib/ansible/plugins/terminal/__init__.py index a876c7fb060..f4928082f37 100644 --- a/lib/ansible/plugins/terminal/__init__.py +++ b/lib/ansible/plugins/terminal/__init__.py @@ -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