2 Commits

Author SHA1 Message Date
Natan Keddem 61f297aa0b improved job removal 2023-11-23 22:16:30 -05:00
Natan Keddem 425b607e8c cleanup 2023-11-23 22:16:03 -05:00
+11 -5
View File
@@ -268,8 +268,15 @@ class Automation(Tab):
rows = await self._grid.get_selected_rows()
for row in rows:
for job in self.scheduler.scheduler.get_jobs():
j = job.id.split("@")[0]
if j == row["name"]:
auto = automation(job)
if auto is not None and auto.name == row["name"]:
if job.id in job_handlers:
del job_handlers[job.id]
if isinstance(auto, scheduler.Zfs_Autobackup):
for host in auto.hosts:
command = AutomationTemplate(auto.prop)
prop = command.safe_substitute(name=auto.name, host=host)
await self._remove_prop_from_all_fs(host=host, prop=prop)
self.scheduler.scheduler.remove_job(job.id)
self._automations.remove(row)
self._grid.update()
@@ -767,7 +774,6 @@ class Automation(Tab):
self.scheduler.scheduler.remove_job(job.id)
for host in hosts:
auto_id = f"{auto_name}@{host}"
if self.previous_prop != "":
command = AutomationTemplate(self.previous_prop)
prop = command.safe_substitute(name=auto_name, host=host)
@@ -810,8 +816,8 @@ class Automation(Tab):
)
elif self.app.value == "remote":
for job in jobs:
j = job.id.split("@")[0]
if j == auto_name:
auto = automation(job)
if auto is not None and auto.name == auto_name:
self.scheduler.scheduler.remove_job(job.id)
for host in hosts:
auto_id = f"{auto_name}@{host}"