From 96fe0982780e86aef7899c60b242ca97b7aa8ff5 Mon Sep 17 00:00:00 2001 From: Lijuan Tu Date: Tue, 28 Mar 2017 09:55:24 +0800 Subject: nics/net_device: fix list remove bug Remove all the match network device object by copy list first. Signed-off-by: Lijuan Tu --- nics/net_device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nics') diff --git a/nics/net_device.py b/nics/net_device.py index ba3d9c2..0af4ad5 100644 --- a/nics/net_device.py +++ b/nics/net_device.py @@ -885,7 +885,7 @@ def remove_from_list(host): Remove network device object from global structure Parameter will by host ip """ - for nic in NICS_LIST: + for nic in NICS_LIST[:]: if host == nic['host']: NICS_LIST.remove(nic) -- cgit v1.2.3