updating main for loop based on @abadger code review
This commit is contained in:
parent
c72be32b94
commit
6522e4e016
1 changed files with 8 additions and 10 deletions
|
@ -157,17 +157,15 @@ def main():
|
||||||
to_number = module.params['to_number']
|
to_number = module.params['to_number']
|
||||||
media_url = module.params['media_url']
|
media_url = module.params['media_url']
|
||||||
|
|
||||||
try:
|
if not isinstance(to_number, list):
|
||||||
if isinstance(to_number, list):
|
to_number = [to_number]
|
||||||
for number in to_number:
|
|
||||||
post_twilio_api(module, account_sid, auth_token, msg,
|
for number in to_number:
|
||||||
from_number, number, media_url)
|
try:
|
||||||
else:
|
|
||||||
post_twilio_api(module, account_sid, auth_token, msg,
|
post_twilio_api(module, account_sid, auth_token, msg,
|
||||||
from_number, to_number, media_url)
|
from_number, number, media_url)
|
||||||
pass
|
except Exception:
|
||||||
except Exception:
|
module.fail_json(msg="unable to send message to %s" % number)
|
||||||
module.fail_json(msg="unable to send text message to %s" % to_number)
|
|
||||||
|
|
||||||
module.exit_json(msg=msg, changed=False)
|
module.exit_json(msg=msg, changed=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue