mattmakai / fullstackpython.com

Full Stack Python source with Pelican, Bootstrap and Markdown.
https://www.fullstackpython.com/
MIT License
2.88k stars 627 forks source link

Twilio 'post_twilio_api' is not defined #73

Open kflavin opened 8 years ago

kflavin commented 8 years ago

I'm going through the Full Stack Python Deployment PDF. On page 137, I'm attempting to configure Twilio alerts on successful deployment. I have the following in my main.yml:

- name: alert that deployment is complete
  twilio:
    msg: "Deployment complete!"
    account_sid: "{{ wsgi_env_vars.TWILIO_ACCOUNT_SID }}"
    auth_token: "{{ wsgi_env_vars.TWILIO_AUTH_TOKEN }}"
    from_number: "{{ wsgi_env_vars.TWILIO_NUMBER }}"
    to_number: "{{ alert_number }}"
  delegate_to: localhost
  when: deployment_alert

When I run deploy_prod.sh, I get an error that "post_twilio_api" is not defined.

TASK: [common | alert that deployment is complete] **************************** 
failed: [<myip> -> localhost] => {"failed": true, "parsed": false}
Traceback (most recent call last):
  File "/home/<myuser>/.ansible/tmp/ansible-tmp-1449278658.43-275151344117765/twilio", line 2515, in <module>
    main()
  File "/home/<myuser>/.ansible/tmp/ansible-tmp-1449278658.43-275151344117765/twilio", line 123, in main
    r, info = post_twilio_api(module, account_sid, auth_token, msg,
NameError: global name 'post_twilio_api' is not defined

FATAL: all hosts have already failed -- aborting

Tracing back that symbol, it appears to be a function call in the ansible module: ansible/modules/extras/notification/twilio.py.

I'm running ansible versino 1.9.4, and Twilio support seems to be available in 1.6. Am I missing a module of some sort?

Thanks, Kyle

mattmakai commented 8 years ago

@kflavin yea, I'm able to replicate this as well. Not clear what's happening just from reading the source. I'll try with an older version of Ansible. I know there were some modifications made by the Ansible folks and it's possible some issue was inadvertently introduced along the way

kflavin commented 8 years ago

Thanks. It seems to be the version of Ansible I was running (1.9.4). I downgraded to 1.9.2, and Twilio is working.