1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

updating main for loop based on @abadger code review

This commit is contained in:
Matthew Makai 2015-04-13 12:06:27 -04:00 committed by Matt Clay
parent 6db9b2beda
commit 065b2fe309

View file

@ -157,17 +157,15 @@ def main():
to_number = module.params['to_number']
media_url = module.params['media_url']
try:
if isinstance(to_number, list):
for number in to_number:
post_twilio_api(module, account_sid, auth_token, msg,
from_number, number, media_url)
else:
if not isinstance(to_number, list):
to_number = [to_number]
for number in to_number:
try:
post_twilio_api(module, account_sid, auth_token, msg,
from_number, to_number, media_url)
pass
except Exception:
module.fail_json(msg="unable to send text message to %s" % to_number)
from_number, number, media_url)
except Exception:
module.fail_json(msg="unable to send message to %s" % number)
module.exit_json(msg=msg, changed=False)