From d829ff6993aa3a7e8123d2188ab04f4bfd88c1d0 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Thu, 24 May 2018 10:02:02 -0400 Subject: [PATCH] fixes bug with matching nxos prompts (#40655) This change addresses an issue where the prompt matching regular expressions would not match a prompt if the hostname starts with a numeric value. Before this change, the connection would fail with a socket.timeout() error. This change updates the termnal_stdout_re values to now check for a number. See Github issue #38639 --- lib/ansible/plugins/terminal/nxos.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/terminal/nxos.py b/lib/ansible/plugins/terminal/nxos.py index fcccfe155e..385ab9b1d2 100644 --- a/lib/ansible/plugins/terminal/nxos.py +++ b/lib/ansible/plugins/terminal/nxos.py @@ -30,8 +30,8 @@ from ansible.module_utils._text import to_bytes, to_text class TerminalModule(TerminalBase): terminal_stdout_re = [ - re.compile(br'[\r\n]?(?!\s*<)?(\x1b\S+)*[a-zA-Z_]{1}[a-zA-Z0-9-_.]*[>|#|%](?:\s*)*(\x1b\S+)*$'), - re.compile(br'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-_.]*\(.+\)#(?:\s*)$') + re.compile(br'[\r\n]?(?!\s*<)?(\x1b\S+)*[a-zA-Z_0-9]{1}[a-zA-Z0-9-_.]*[>|#|%](?:\s*)*(\x1b\S+)*$'), + re.compile(br'[\r\n]?[a-zA-Z0-9]{1}[a-zA-Z0-9-_.]*\(.+\)#(?:\s*)$') ] terminal_stderr_re = [