mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 08:21:15 +03:00
Update Organization Notification Template subclass, move success/fail wfj notification trigger
This commit is contained in:
parent
dd372548a9
commit
68fe23d8b7
@ -181,27 +181,18 @@ class OrganizationNotificationTemplatesAnyList(SubListCreateAttachDetachAPIView)
|
|||||||
relationship = 'notification_templates_any'
|
relationship = 'notification_templates_any'
|
||||||
|
|
||||||
|
|
||||||
class OrganizationNotificationTemplatesStartedList(SubListCreateAttachDetachAPIView):
|
class OrganizationNotificationTemplatesStartedList(OrganizationNotificationTemplatesAnyList):
|
||||||
|
|
||||||
model = NotificationTemplate
|
|
||||||
serializer_class = NotificationTemplateSerializer
|
|
||||||
parent_model = Organization
|
|
||||||
relationship = 'notification_templates_started'
|
relationship = 'notification_templates_started'
|
||||||
|
|
||||||
|
|
||||||
class OrganizationNotificationTemplatesErrorList(SubListCreateAttachDetachAPIView):
|
class OrganizationNotificationTemplatesErrorList(OrganizationNotificationTemplatesAnyList):
|
||||||
|
|
||||||
model = NotificationTemplate
|
|
||||||
serializer_class = NotificationTemplateSerializer
|
|
||||||
parent_model = Organization
|
|
||||||
relationship = 'notification_templates_error'
|
relationship = 'notification_templates_error'
|
||||||
|
|
||||||
|
|
||||||
class OrganizationNotificationTemplatesSuccessList(SubListCreateAttachDetachAPIView):
|
class OrganizationNotificationTemplatesSuccessList(OrganizationNotificationTemplatesAnyList):
|
||||||
|
|
||||||
model = NotificationTemplate
|
|
||||||
serializer_class = NotificationTemplateSerializer
|
|
||||||
parent_model = Organization
|
|
||||||
relationship = 'notification_templates_success'
|
relationship = 'notification_templates_success'
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,6 +193,8 @@ class TaskManager():
|
|||||||
status_changed = True
|
status_changed = True
|
||||||
if status_changed:
|
if status_changed:
|
||||||
workflow_job.websocket_emit_status(workflow_job.status)
|
workflow_job.websocket_emit_status(workflow_job.status)
|
||||||
|
# Operations whose queries rely on modifications made during the atomic scheduling session
|
||||||
|
connection.on_commit(lambda: workflow_job.send_notification_templates('succeeded' if workflow_job.status == 'successful' else 'failed'))
|
||||||
if workflow_job.spawned_by_workflow:
|
if workflow_job.spawned_by_workflow:
|
||||||
schedule_task_manager()
|
schedule_task_manager()
|
||||||
return result
|
return result
|
||||||
@ -582,10 +584,5 @@ class TaskManager():
|
|||||||
logger.debug("Not running scheduler, another task holds lock")
|
logger.debug("Not running scheduler, another task holds lock")
|
||||||
return
|
return
|
||||||
logger.debug("Starting Scheduler")
|
logger.debug("Starting Scheduler")
|
||||||
|
|
||||||
with task_manager_bulk_reschedule():
|
with task_manager_bulk_reschedule():
|
||||||
finished_wfjs = self._schedule()
|
self._schedule()
|
||||||
|
|
||||||
# Operations whose queries rely on modifications made during the atomic scheduling session
|
|
||||||
for wfj in WorkflowJob.objects.filter(id__in=finished_wfjs):
|
|
||||||
wfj.send_notification_templates('succeeded' if wfj.status == 'successful' else 'failed')
|
|
||||||
|
Loading…
Reference in New Issue
Block a user