Skip to content

Commit 61f297a

Browse files
committed
improved job removal
1 parent 425b607 commit 61f297a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

bale/tabs/automation.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,15 @@ async def _remove_automation(self) -> None:
268268
rows = await self._grid.get_selected_rows()
269269
for row in rows:
270270
for job in self.scheduler.scheduler.get_jobs():
271-
j = job.id.split("@")[0]
272-
if j == row["name"]:
271+
auto = automation(job)
272+
if auto is not None and auto.name == row["name"]:
273+
if job.id in job_handlers:
274+
del job_handlers[job.id]
275+
if isinstance(auto, scheduler.Zfs_Autobackup):
276+
for host in auto.hosts:
277+
command = AutomationTemplate(auto.prop)
278+
prop = command.safe_substitute(name=auto.name, host=host)
279+
await self._remove_prop_from_all_fs(host=host, prop=prop)
273280
self.scheduler.scheduler.remove_job(job.id)
274281
self._automations.remove(row)
275282
self._grid.update()

0 commit comments

Comments
 (0)