Fix: Instantiate the same NS without emulator restart
Fixes a bug that causes the emulator to not properly clean
its internal data structures when a NS is deleted. This could
cause errors when a NS should be instantiated again, without
restarting the emulator.
Change-Id: I8a0be1f28b889f2c01e7ef859acd6bdcc35b8b9d
Signed-off-by: peusterm <manuel.peuster@uni-paderborn.de>
diff --git a/src/emuvim/api/openstack/compute.py b/src/emuvim/api/openstack/compute.py
index 42f0064..7ba52f1 100755
--- a/src/emuvim/api/openstack/compute.py
+++ b/src/emuvim/api/openstack/compute.py
@@ -585,12 +585,10 @@
if server is None:
return False
name_parts = server.name.split('_')
- if len(name_parts) < 3:
- return False
-
- for stack in self.stacks.values():
- if stack.stack_name == name_parts[1]:
- stack.servers.pop(server.id, None)
+ if len(name_parts) > 1:
+ for stack in self.stacks.values():
+ if stack.stack_name == name_parts[1]:
+ stack.servers.pop(server.id, None)
if self.computeUnits.pop(server.id, None) is None:
return False
return True