mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-16 14:09:12 -07:00
added timestamps to ios_command module (#50323)
ios_command module now returns timestamps field, which shows command execution time
This commit is contained in:
parent
8719866ae8
commit
2a432a093b
4 changed files with 17 additions and 6 deletions
|
@ -22,6 +22,7 @@ __metaclass__ = type
|
|||
import json
|
||||
|
||||
from units.compat.mock import patch
|
||||
from ansible.module_utils.basic import get_timestamp
|
||||
from ansible.modules.network.ios import ios_command
|
||||
from units.modules.utils import set_module_args
|
||||
from .ios_module import TestIosModule, load_fixture
|
||||
|
@ -46,6 +47,7 @@ class TestIosCommandModule(TestIosModule):
|
|||
def load_from_file(*args, **kwargs):
|
||||
module, commands = args
|
||||
output = list()
|
||||
timestamps = list()
|
||||
|
||||
for item in commands:
|
||||
try:
|
||||
|
@ -55,7 +57,8 @@ class TestIosCommandModule(TestIosModule):
|
|||
command = item['command']
|
||||
filename = str(command).replace(' ', '_')
|
||||
output.append(load_fixture(filename))
|
||||
return output
|
||||
timestamps.append(get_timestamp())
|
||||
return output, timestamps
|
||||
|
||||
self.run_commands.side_effect = load_from_file
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue