mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
added timestamps to nxos_command module (#50261)
* added timestamps to nxos_command module nxos_command module now returns timestamps field, which shows command execution time * fixed unit test failure for /lib/ansible/module_utils/basic * cosmetic changes to align with PEP 8
This commit is contained in:
@@ -23,6 +23,7 @@ import json
|
||||
import re
|
||||
|
||||
from ansible.errors import AnsibleConnectionFailure
|
||||
from ansible.module_utils.basic import get_timestamp
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.module_utils.common._collections_compat import Mapping
|
||||
from ansible.module_utils.connection import ConnectionError
|
||||
@@ -187,6 +188,7 @@ class Cliconf(CliconfBase):
|
||||
raise ValueError("'commands' value is required")
|
||||
|
||||
responses = list()
|
||||
timestamps = list()
|
||||
for cmd in to_list(commands):
|
||||
if not isinstance(cmd, Mapping):
|
||||
cmd = {'command': cmd}
|
||||
@@ -196,6 +198,7 @@ class Cliconf(CliconfBase):
|
||||
cmd['command'] = self._get_command_with_output(cmd['command'], output)
|
||||
|
||||
try:
|
||||
timestamp = get_timestamp()
|
||||
out = self.send_command(**cmd)
|
||||
except AnsibleConnectionFailure as e:
|
||||
if check_rc is True:
|
||||
@@ -214,7 +217,8 @@ class Cliconf(CliconfBase):
|
||||
pass
|
||||
|
||||
responses.append(out)
|
||||
return responses
|
||||
timestamps.append(timestamp)
|
||||
return responses, timestamps
|
||||
|
||||
def get_device_operations(self):
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user