tinfoil: Disable data tracking also when the operation fails
PATCH 1/1 tinfoil: Disable data tracking also when the operation fails
From: Stefano Tondo <[email protected]>
_data_tracked_if_enabled() enables data tracking before the operation and disables it after the operation. If the operation raises an exception, the second step does not run and tracking stays enabled in the server for the rest of the tinfoil session.
Disable tracking in a finally block.
Signed-off-by Stefano Tondo <[email protected]>
--- lib/bb/tinfoil.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
lib/bb/tinfoil.py +5 -4
@@ -789,10 +789,11 @@ class Tinfoil: self.run_command('enableDataTracking') # Here goes the operation with the optional data tracking - yield - - if self.tracking: - self.run_command('disableDataTracking') + try: + yield + finally: + if self.tracking: + self.run_command('disableDataTracking') def finalizeData(self): """
Signature · 1 line
2.56.1