Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

Conversation

@macdiesel
Copy link
Contributor

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

hipchat

ANSIBLE VERSION

2.0.0.1

SUMMARY

Hipchat room names were not being encoded properly when using the hipchat v2 API. When the api is called with a room that contained special character name the URL would be mangled and the api would return a 400 response.

The hipchat room name is now encoded using: urllib.pathname2url

Before:

PLAY [all] ******************************************************************** 

TASK: [Send Hipchat notification AMI is finished baking] ********************** 
<localhost> REMOTE_MODULE hipchat room='release pipeline' api=https://api.hipchat.com/v2/ token=** msg='test message from Ansible! Hello!'
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1459975609.22-241864400016673 && echo $HOME/.ansible/tmp/ansible-tmp-1459975609.22-241864400016673']
<localhost> PUT /tmp/tmpzK2Ho6 TO /root/.ansible/tmp/ansible-tmp-1459975609.22-241864400016673/hipchat
<localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1459975609.22-241864400016673/hipchat; rm -rf /root/.ansible/tmp/ansible-tmp-1459975609.22-241864400016673/ >/dev/null 2>&1']
failed: [localhost] => {"failed": true}
msg: failed to send message, return status=400
...ignoring

After:

PLAY [all] ******************************************************************** 

TASK: [Send Hipchat notification AMI is finished baking] ********************** 
<localhost> REMOTE_MODULE hipchat room='release pipeline' api=https://api.hipchat.com/v2/ token=** msg='test message from Ansible! Hello!'
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1459976273.55-137871830279509 && echo $HOME/.ansible/tmp/ansible-tmp-1459976273.55-137871830279509']
<localhost> PUT /tmp/tmp7s6_G7 TO /root/.ansible/tmp/ansible-tmp-1459976273.55-137871830279509/hipchat
<localhost> EXEC ['/bin/sh', '-c', u'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1459976273.55-137871830279509/hipchat; rm -rf /root/.ansible/tmp/ansible-tmp-1459976273.55-137871830279509/ >/dev/null 2>&1']
changed: [localhost] => {"changed": true, "msg": "test message from Ansible! Hello!", "msg_from": "Ansible", "room": "release pipeline"}

PLAY RECAP ******************************************************************** 
localhost                  : ok=1    changed=1    unreachable=0    failed=0   

@gregdek
Copy link
Contributor

gregdek commented Apr 6, 2016

Thanks @macdiesel. To the current maintainers, @pb8226 please review according to guidelines (http://docs.ansible.com/ansible/developing_modules.html#module-checklist) and comment with text 'shipit' or 'needs_revision' as appropriate.

[This message brought to you by your friendly Ansibull-bot.]

@pb8226
Copy link

pb8226 commented Apr 7, 2016

shipit

@gregdek
Copy link
Contributor

gregdek commented Apr 7, 2016

Thanks again to @macdiesel for this PR, and thanks @pb8226 for reviewing. Marking for inclusion.

[This message brought to you by your friendly Ansibull-bot.]

@resmo
Copy link
Contributor

resmo commented Apr 10, 2016

wondering if just quote or even quote_plus would be a better fit instead of url2pathname. But merging it in and let the maintainer @pb8226 decide.

@resmo resmo merged commit 474baaa into ansible:devel Apr 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants