From 1cf00a515178d2ca8bb1f36ef527c4ed7efccfbf Mon Sep 17 00:00:00 2001 From: Ganesh Nalawade Date: Wed, 20 Sep 2017 14:35:15 +0530 Subject: [PATCH] Add underscore and period to regex for hostname prompt (#30612) * Add _ and . to regex (#30396) Adding underscore and period to the nxos regex for determining the prompt for hostnames with underscores and periods in the hostname. (cherry picked from commit 33b8d7069fa8bdccf7a849cf6e55193a011a9063) * Add change log --- CHANGELOG.md | 1 + lib/ansible/plugins/terminal/nxos.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d546a815063..3494d5e2499 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Ansible Changes By Release * Fixed docs for 'password' lookup * Corrected and added missing feature and porting docs for 2.4 * Fix for Ansible.ModuleUtils.CamelConversion to handle empty lists and lists with one entry +* Fix nxos terminal regex to parse username correctly. diff --git a/lib/ansible/plugins/terminal/nxos.py b/lib/ansible/plugins/terminal/nxos.py index ef4fb63a949..22ca2adcea4 100644 --- a/lib/ansible/plugins/terminal/nxos.py +++ b/lib/ansible/plugins/terminal/nxos.py @@ -28,8 +28,8 @@ from ansible.errors import AnsibleConnectionFailure class TerminalModule(TerminalBase): terminal_stdout_re = [ - re.compile(br'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-]*[>|#|%](?:\s*)$'), - re.compile(br'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-]*\(.+\)#(?:\s*)$') + re.compile(br'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-_.]*[>|#|%](?:\s*)$'), + re.compile(br'[\r\n]?[a-zA-Z]{1}[a-zA-Z0-9-_.]*\(.+\)#(?:\s*)$') ] terminal_stderr_re = [