Fri, May 07, 2021 at 03:17:34PM CEST, olichtne(a)redhat.com wrote:
On Mon, May 03, 2021 at 10:35:33AM +0200, Jan Tluka wrote:
> + def cleanup(self):
> + """
> + This method deletes all tunnels created previously through the instance
> + of this object. The method serves as a convenient way to cleanup at the
> + end of a recipe.
> + """
> + for tunnel_id in self._tunnels:
> + self.delete_tunnel(tunnel_id)
> + self._tunnels.remove(tunnel_id)
in general it's not a good idea to modify an iterable object inside the
loop that is iterating it. It would be safer to just do:
self._tunnels.clear()
after the loop is done.
-Ondrej
I must have missed this. Definitely makes sense. I'll fix that.
J.