Merge pull request #17254 from privateip/netcli
adds new property command_string to Command object
This commit is contained in:
commit
fb9b98a543
1 changed files with 3 additions and 2 deletions
|
@ -102,6 +102,7 @@ class Command(object):
|
||||||
|
|
||||||
self.command = command
|
self.command = command
|
||||||
self.output = output
|
self.output = output
|
||||||
|
self.command_string = command
|
||||||
|
|
||||||
self.prompt = prompt
|
self.prompt = prompt
|
||||||
self.response = response
|
self.response = response
|
||||||
|
@ -110,7 +111,7 @@ class Command(object):
|
||||||
self.delay = delay
|
self.delay = delay
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.command
|
return self.command_string
|
||||||
|
|
||||||
class CommandRunner(object):
|
class CommandRunner(object):
|
||||||
|
|
||||||
|
@ -145,7 +146,7 @@ class CommandRunner(object):
|
||||||
return cmdobj.response
|
return cmdobj.response
|
||||||
except KeyError:
|
except KeyError:
|
||||||
for cmd in self.commands:
|
for cmd in self.commands:
|
||||||
if str(cmd) == command and cmd.output == output:
|
if cmd.command == command and cmd.output == output:
|
||||||
self._cache[(command, output)] = cmd
|
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)
|
||||||
|
|
Loading…
Reference in a new issue