[2.6] Add ambiguous command check as the error message is not persistent on nexus devices (#45342)

* Add ambiguous command check as the error message is not persistent on nexus devices (#45337)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit f18856d0e2)

* changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-09-26 03:11:21 +05:30 committed by Matt Clay
parent e459893601
commit 643726860b
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- Add ambiguous command check as the error message is not persistent on nexus devices (https://github.com/ansible/ansible/pull/45337).

View file

@ -156,7 +156,7 @@ class Cli:
if network_api == 'cliconf' and out:
for index, resp in enumerate(out):
if 'Invalid command at' in resp and 'json' in resp:
if ('Invalid command at' in resp or 'Ambiguous command at' in resp) and 'json' in resp:
if commands[index]['output'] == 'json':
commands[index]['output'] = 'text'
out = connection.run_commands(commands, check_rc)