added timestamps to ios_command module (#50323)

ios_command module now returns timestamps field, which shows command execution time
This commit is contained in:
vaneuk 2019-01-31 15:41:53 +03:00 committed by Sumit Jaiswal
parent 8719866ae8
commit 2a432a093b
4 changed files with 17 additions and 6 deletions

View file

@ -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