diff --git a/src/middlewared/middlewared/plugins/snapshot.py b/src/middlewared/middlewared/plugins/snapshot.py index deb02d51bda17..20f417cd51858 100644 --- a/src/middlewared/middlewared/plugins/snapshot.py +++ b/src/middlewared/middlewared/plugins/snapshot.py @@ -281,8 +281,10 @@ 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']) + else: + audit_callback(f'Task id {id_} not found') for replication_task in await self.middleware.call('replication.query', [ ['direction', '=', 'PUSH'],