mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-28 15:41:22 -07:00
Merge pull request #17425 from privateip/netcli
removes command caching on retrieve from netcli
This commit is contained in:
commit
52d1187f5c
1 changed files with 3 additions and 10 deletions
|
@ -124,7 +124,6 @@ class CommandRunner(object):
|
||||||
|
|
||||||
self.match = 'all'
|
self.match = 'all'
|
||||||
|
|
||||||
self._cache = dict()
|
|
||||||
self._default_output = module.connection.default_output
|
self._default_output = module.connection.default_output
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,15 +136,9 @@ class CommandRunner(object):
|
||||||
self.commands.append(cmd)
|
self.commands.append(cmd)
|
||||||
|
|
||||||
def get_command(self, command, output=None):
|
def get_command(self, command, output=None):
|
||||||
output = output or self._default_output
|
for cmd in self.commands:
|
||||||
try:
|
if cmd.command == command:
|
||||||
cmdobj = self._cache[(command, output)]
|
return cmd.response
|
||||||
return cmdobj.response
|
|
||||||
except KeyError:
|
|
||||||
for cmd in self.commands:
|
|
||||||
if cmd.command == command and cmd.output == output:
|
|
||||||
self._cache[(command, output)] = cmd
|
|
||||||
return cmd.response
|
|
||||||
raise ValueError("command '%s' not found" % command)
|
raise ValueError("command '%s' not found" % command)
|
||||||
|
|
||||||
def get_responses(self):
|
def get_responses(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue