Skip to content

Commit

Permalink
NAS-130508 / 24.10 / Fix test regression in snapshot task deletion (#…
Browse files Browse the repository at this point in the history
…14169)

Adding an audit callback function with dataset name introduced a
new failure condition for case where snapshot task matching the
id does not exist.
  • Loading branch information
anodos325 authored Aug 8, 2024
1 parent 0de447b commit 62bd710
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/middlewared/middlewared/plugins/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit 62bd710

Please sign in to comment.