From 420a1c2da29c0fc82de23061036180e1b24e52e9 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 30 Mar 2015 17:03:49 +0200 Subject: [PATCH] Fix rare crash in tests for travis and fix coverage --- .travis.yml | 2 +- gns3server/modules/vpcs/__init__.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index dadbe57c..6009954f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,4 +29,4 @@ notifications: # on_failure: always after_success: - - coveralls + - coveralls --base_dir gns3server diff --git a/gns3server/modules/vpcs/__init__.py b/gns3server/modules/vpcs/__init__.py index bae14fe1..f79e2b8d 100644 --- a/gns3server/modules/vpcs/__init__.py +++ b/gns3server/modules/vpcs/__init__.py @@ -52,7 +52,8 @@ class VPCS(BaseManager): vm = self.get_vm(vm_id) i = self._used_mac_ids[vm_id] self._free_mac_ids[vm.project.id].insert(0, i) - del self._used_mac_ids[vm_id] + if vm_id in self._used_mac_ids: + del self._used_mac_ids[vm_id] yield from super().close_vm(vm_id, *args, **kwargs) return vm