From: Ondrej Lichtner <olichtne(a)redhat.com>
The get_cmd method of the NetTestCommandContext class now returns a None
object instead of throwing an exception when no command with the
specified id is found.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Common/NetTestCommand.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
index c24110e..6944051 100644
--- a/lnst/Common/NetTestCommand.py
+++ b/lnst/Common/NetTestCommand.py
@@ -234,7 +234,10 @@ class NetTestCommandContext:
del self._dict[cmd.get_id()]
def get_cmd(self, id):
- return self._dict[id]
+ if id in self._dict:
+ return self._dict[id]
+ else:
+ return None
def _kill_all_cmds(self):
for id in self._dict:
--
2.5.0