From 3d74447fd9b7662cf7ce7bb07286f9518b0ca510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Wed, 22 Mar 2023 10:41:09 +0100 Subject: [PATCH] can't abort transaction if creation failed --- src/capport/utils/nft_socket.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/capport/utils/nft_socket.py b/src/capport/utils/nft_socket.py index 9cf2670..f2cae4b 100644 --- a/src/capport/utils/nft_socket.py +++ b/src/capport/utils/nft_socket.py @@ -91,8 +91,8 @@ class NFTSocket(pyroute2.netlink.nlsocket.NetlinkSocket): @contextlib.contextmanager def begin(self) -> typing.Generator[NFTTransaction, None, None]: + tx = NFTTransaction(socket=self) try: - tx = NFTTransaction(socket=self) yield tx # autocommit when no exception was raised # (only commits if it wasn't aborted)