2
0

can't abort transaction if creation failed

This commit is contained in:
Stefan Bühler 2023-03-22 10:41:09 +01:00
parent a89e884b75
commit 3d74447fd9

View File

@ -91,8 +91,8 @@ class NFTSocket(pyroute2.netlink.nlsocket.NetlinkSocket):
@contextlib.contextmanager
def begin(self) -> typing.Generator[NFTTransaction, None, None]:
try:
tx = NFTTransaction(socket=self)
try:
yield tx
# autocommit when no exception was raised
# (only commits if it wasn't aborted)