commit 7d2b2d91856a5be8f2bc23a24bfaafbc9f11b618
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Nov 7 11:32:50 2014 +0100
InterfaceManager: unmap devices from tmp mapping
The unmap_if method now checks if the if_id is present in _id_mapping or
_tmp_mapping.
Even though this method should only be called in the cleanup phase of a
test run when every interface should have been moved to _id_mapping this
patch should prevent exceptions being thrown in unexpected scenarios.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Slave/InterfaceManager.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index a557322..de2042d 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -52,7 +52,12 @@ class InterfaceManager(object):
return
def unmap_if(self, if_id):
- del self._id_mapping[if_id]
+ if if_id in self._id_mapping:
+ del self._id_mapping[if_id]
+ elif if_id in self._tmp_mapping:
+ del self._tmp_mapping[if_id]
+ else:
+ pass
def clear_if_mapping(self):
self._id_mapping = {}
Show replies by date