mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Revert nxos, ios, iosxr return_timestamps (#56206)
* Revert "nxos_command:run_commands results failure when commands array size >1 (#52670)" This reverts commit0df5b92af3. * Revert "added timestamps to nxos_command module (#50261)" This reverts commite150943314. * Revert "added timestamps to ios_command module (#50323)" This reverts commit2a432a093b. * Revert "added response_timestamps to iosxr_command module (#50095)" This reverts commit2a0c356da9.
This commit is contained in:
@@ -38,7 +38,6 @@ from itertools import chain
|
||||
|
||||
from ansible.errors import AnsibleConnectionFailure
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.basic import get_timestamp
|
||||
from ansible.module_utils.common._collections_compat import Mapping
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.network.common.config import NetworkConfig, dumps
|
||||
@@ -287,12 +286,11 @@ class Cliconf(CliconfBase):
|
||||
|
||||
return resp
|
||||
|
||||
def run_commands(self, commands=None, check_rc=True, return_timestamps=False):
|
||||
def run_commands(self, commands=None, check_rc=True):
|
||||
if commands is None:
|
||||
raise ValueError("'commands' value is required")
|
||||
|
||||
responses = list()
|
||||
timestamps = list()
|
||||
for cmd in to_list(commands):
|
||||
if not isinstance(cmd, Mapping):
|
||||
cmd = {'command': cmd}
|
||||
@@ -303,19 +301,14 @@ class Cliconf(CliconfBase):
|
||||
|
||||
try:
|
||||
out = self.send_command(**cmd)
|
||||
timestamp = get_timestamp()
|
||||
except AnsibleConnectionFailure as e:
|
||||
if check_rc:
|
||||
raise
|
||||
out = getattr(e, 'err', to_text(e))
|
||||
|
||||
responses.append(out)
|
||||
timestamps.append(timestamp)
|
||||
|
||||
if return_timestamps:
|
||||
return responses, timestamps
|
||||
else:
|
||||
return responses
|
||||
return responses
|
||||
|
||||
def get_defaults_flag(self):
|
||||
"""
|
||||
|
||||
@@ -35,7 +35,6 @@ import json
|
||||
|
||||
from ansible.errors import AnsibleConnectionFailure
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.basic import get_timestamp
|
||||
from ansible.module_utils.common._collections_compat import Mapping
|
||||
from ansible.module_utils.connection import ConnectionError
|
||||
from ansible.module_utils.network.common.config import NetworkConfig, dumps
|
||||
@@ -184,11 +183,10 @@ class Cliconf(CliconfBase):
|
||||
|
||||
self.send_command(**cmd_obj)
|
||||
|
||||
def run_commands(self, commands=None, check_rc=True, return_timestamps=False):
|
||||
def run_commands(self, commands=None, check_rc=True):
|
||||
if commands is None:
|
||||
raise ValueError("'commands' value is required")
|
||||
responses = list()
|
||||
timestamps = list()
|
||||
for cmd in to_list(commands):
|
||||
if not isinstance(cmd, Mapping):
|
||||
cmd = {'command': cmd}
|
||||
@@ -198,7 +196,6 @@ class Cliconf(CliconfBase):
|
||||
raise ValueError("'output' value %s is not supported for run_commands" % output)
|
||||
|
||||
try:
|
||||
timestamp = get_timestamp()
|
||||
out = self.send_command(**cmd)
|
||||
except AnsibleConnectionFailure as e:
|
||||
if check_rc:
|
||||
@@ -217,11 +214,7 @@ class Cliconf(CliconfBase):
|
||||
pass
|
||||
|
||||
responses.append(out)
|
||||
timestamps.append(timestamp)
|
||||
if return_timestamps:
|
||||
return responses, timestamps
|
||||
else:
|
||||
return responses
|
||||
return responses
|
||||
|
||||
def discard_changes(self):
|
||||
self.send_command('abort')
|
||||
|
||||
@@ -34,7 +34,6 @@ 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
|
||||
@@ -199,7 +198,6 @@ 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}
|
||||
@@ -209,7 +207,6 @@ 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:
|
||||
@@ -228,8 +225,7 @@ class Cliconf(CliconfBase):
|
||||
pass
|
||||
|
||||
responses.append(out)
|
||||
timestamps.append(timestamp)
|
||||
return responses, timestamps
|
||||
return responses
|
||||
|
||||
def get_device_operations(self):
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user