Revert "fix(jobspec): Delete ipsec nfv density tests"
[csit.git] / resources / libraries / python / Namespaces.py
index 2bdcbcb..d78d2f6 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Cisco and/or its affiliates.
+# Copyright (c) 2021 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
@@ -13,6 +13,8 @@
 
 """Linux namespace utilities library."""
 
+from copy import deepcopy
+
 from resources.libraries.python.ssh import exec_cmd_no_error, exec_cmd
 
 
@@ -145,5 +147,6 @@ class Namespaces:
             Namespaces.delete_namespace(node, namespace)
             return
 
-        for namespace_name in Namespaces.__namespaces:
+        namespace_copy = deepcopy(Namespaces.__namespaces)
+        for namespace_name in namespace_copy:
             Namespaces.delete_namespace(node, namespace_name)