can't abort transaction if creation failed
This commit is contained in:
parent
a89e884b75
commit
3d74447fd9
@ -91,8 +91,8 @@ class NFTSocket(pyroute2.netlink.nlsocket.NetlinkSocket):
|
|||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def begin(self) -> typing.Generator[NFTTransaction, None, None]:
|
def begin(self) -> typing.Generator[NFTTransaction, None, None]:
|
||||||
|
tx = NFTTransaction(socket=self)
|
||||||
try:
|
try:
|
||||||
tx = NFTTransaction(socket=self)
|
|
||||||
yield tx
|
yield tx
|
||||||
# autocommit when no exception was raised
|
# autocommit when no exception was raised
|
||||||
# (only commits if it wasn't aborted)
|
# (only commits if it wasn't aborted)
|
||||||
|
Loading…
Reference in New Issue
Block a user