Skip to content

Commit 57633fc

Browse files
committed
allow users to clean the job-stati using the 'stop' button
1 parent 790da11 commit 57633fc

File tree

1 file changed

+4
-0
lines changed
  • src/ansibleguy-webui/aw/api_endpoints

1 file changed

+4
-0
lines changed

src/ansibleguy-webui/aw/api_endpoints/job.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from aw.execute.queue import queue_add
1919
from aw.execute.util import update_status, is_execution_status
2020
from aw.utils.util import is_set, ansible_log_html, ansible_log_text
21+
from aw.model.base import JOB_EXEC_STATI_ACTIVE, JOB_EXEC_STATUS_FAILED
2122
from aw.base import USERS
2223

2324

@@ -362,6 +363,9 @@ def delete(self, request, job_id: int, exec_id: int):
362363
return Response(data={'msg': f"Not privileged to stop the job '{job.name}'"}, status=403)
363364

364365
if not is_execution_status(execution, 'Running'):
366+
JobExecution.objects.filter(
367+
status__in=JOB_EXEC_STATI_ACTIVE, job=job,
368+
).update(status=JOB_EXEC_STATUS_FAILED)
365369
return Response(data={'msg': f"Job execution '{job.name}' is not running"}, status=400)
366370

367371
update_status(execution, 'Stopping')

0 commit comments

Comments
 (0)