1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 06:51:10 +03:00

Fix issue where only one NT attached to UJT would be used to send notifications

This commit is contained in:
Jim Ladd 2019-08-20 20:32:06 -07:00
parent 7a6e62c022
commit 487276613f

View File

@ -484,7 +484,11 @@ class JobNotificationMixin(object):
except AttributeError:
raise NotImplementedError("build_notification_message() does not exist" % status)
def send_it():
send_notifications.delay([nt.generate_notification(notification_subject, notification_body).id],
# Use kwargs to force late-binding
# https://stackoverflow.com/a/3431699/10669572
def send_it(local_nt=nt, local_subject=notification_subject, local_body=notification_body):
def _func():
send_notifications.delay([local_nt.generate_notification(local_subject, local_body).id],
job_id=self.id)
connection.on_commit(send_it)
return _func
connection.on_commit(send_it())