mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 13:27:40 -02:30
Fix twilio_backend.py to send SMS to multiple destinations. (#14656)
AWX only sends Twilio notifications to one destination with the current version of code, but this is a bug. Fixed this bug for sending SMS to multiple destinations.
This commit is contained in:
@@ -39,11 +39,15 @@ class TwilioBackend(AWXBaseEmailBackend, CustomNotificationBase):
|
|||||||
logger.error(smart_str(_("Exception connecting to Twilio: {}").format(e)))
|
logger.error(smart_str(_("Exception connecting to Twilio: {}").format(e)))
|
||||||
|
|
||||||
for m in messages:
|
for m in messages:
|
||||||
try:
|
failed = False
|
||||||
connection.messages.create(to=m.to, from_=m.from_email, body=m.subject)
|
for dest in m.to:
|
||||||
sent_messages += 1
|
try:
|
||||||
except Exception as e:
|
logger.debug(smart_str(_("FROM: {} / TO: {}").format(m.from_email, dest)))
|
||||||
logger.error(smart_str(_("Exception sending messages: {}").format(e)))
|
connection.messages.create(to=dest, from_=m.from_email, body=m.subject)
|
||||||
if not self.fail_silently:
|
sent_messages += 1
|
||||||
raise
|
except Exception as e:
|
||||||
|
logger.error(smart_str(_("Exception sending messages: {}").format(e)))
|
||||||
|
failed = True
|
||||||
|
if not self.fail_silently and failed:
|
||||||
|
raise
|
||||||
return sent_messages
|
return sent_messages
|
||||||
|
|||||||
Reference in New Issue
Block a user