removes command caching on retrieve from netcli

The caching of commands in CommandRunner is providing no useful feature
and causing problems.  This removes the code and simply returns the
requested command results.
pull/4420/head
Peter Sprygada 2016-09-06 16:53:14 -04:00
parent 37f721f315
commit da931b04ad
1 changed files with 3 additions and 10 deletions

View File

@ -127,7 +127,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
@ -140,14 +139,8 @@ 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
try:
cmdobj = self._cache[(command, output)]
return cmdobj.response
except KeyError:
for cmd in self.commands: for cmd in self.commands:
if cmd.command == command and cmd.output == output: if cmd.command == command:
self._cache[(command, output)] = cmd
return cmd.response return cmd.response
raise ValueError("command '%s' not found" % command) raise ValueError("command '%s' not found" % command)