From 344874f891f8bd08db11e2dd63e43c1102211625 Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Thu, 8 Aug 2024 07:27:16 -0700 Subject: [PATCH] Fix test regression in snapshot task deletion Adding an audit callback function with dataset name introduced a new failure condition for case where snapshot task matching the id does not exist. --- src/middlewared/middlewared/plugins/snapshot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/middlewared/middlewared/plugins/snapshot.py b/src/middlewared/middlewared/plugins/snapshot.py index deb02d51bda17..859f65b5e8fdc 100644 --- a/src/middlewared/middlewared/plugins/snapshot.py +++ b/src/middlewared/middlewared/plugins/snapshot.py @@ -281,8 +281,8 @@ async def do_delete(self, audit_callback, id_, options): } """ - dataset = (await self.get_instance(id_))['dataset'] - audit_callback(dataset) + if (task := await self.query([['id','=', id_]])): + audit_callback(task[0]['dataset']) for replication_task in await self.middleware.call('replication.query', [ ['direction', '=', 'PUSH'],