mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 14:20:22 -07:00
roll up of fixes for nxos_facts (#21954)
* fixes commands to work with nxapi * updates test case timeouts
This commit is contained in:
parent
16a39639f5
commit
a284c3f7ea
4 changed files with 22 additions and 19 deletions
|
@ -208,7 +208,7 @@ class Nxapi:
|
|||
|
||||
return dict(ins_api=msg)
|
||||
|
||||
def send_request(self, commands, output='text'):
|
||||
def send_request(self, commands, output='text', check_status=True):
|
||||
# only 10 show commands can be encoded in each request
|
||||
# messages sent to the remote device
|
||||
if output != 'config':
|
||||
|
@ -255,12 +255,13 @@ class Nxapi:
|
|||
except ValueError:
|
||||
self._module.fail_json(msg='unable to parse response')
|
||||
|
||||
output = response['ins_api']['outputs']['output']
|
||||
for item in to_list(output):
|
||||
if item['code'] != '200':
|
||||
self._error(output=output, **item)
|
||||
else:
|
||||
result.append(item['body'])
|
||||
if check_status:
|
||||
output = response['ins_api']['outputs']['output']
|
||||
for item in to_list(output):
|
||||
if item['code'] != '200':
|
||||
self._error(output=output, **item)
|
||||
else:
|
||||
result.append(item['body'])
|
||||
|
||||
return result
|
||||
|
||||
|
@ -288,7 +289,7 @@ class Nxapi:
|
|||
queue = list()
|
||||
responses = list()
|
||||
|
||||
_send = lambda commands, output: self.send_request(commands, output)
|
||||
_send = lambda commands, output: self.send_request(commands, output, check_status=check_rc)
|
||||
|
||||
for item in to_list(commands):
|
||||
if is_json(item['command']):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue