mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
nxos_vlan refactor to support non structured output (#43805)
* nxos_vlan refactor to support non structured output Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * unittest fix Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * minor fixes Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * use check_rc Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * address review comment Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * remove additional return statement * address Nate's review Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
@@ -154,7 +154,18 @@ class Cli:
|
||||
connection = self._get_connection()
|
||||
|
||||
try:
|
||||
return connection.run_commands(commands, check_rc)
|
||||
out = connection.run_commands(commands, check_rc)
|
||||
if check_rc == 'retry_json':
|
||||
capabilities = self.get_capabilities()
|
||||
network_api = capabilities.get('network_api')
|
||||
|
||||
if network_api == 'cliconf' and out:
|
||||
for index, resp in enumerate(out):
|
||||
if 'Invalid command at' in resp and 'json' in resp:
|
||||
if commands[index]['output'] == 'json':
|
||||
commands[index]['output'] = 'text'
|
||||
out = connection.run_commands(commands, check_rc)
|
||||
return out
|
||||
except ConnectionError as exc:
|
||||
self._module.fail_json(msg=to_text(exc))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user