Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/notification/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/notification/hipchat.pyo

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	dd
l
Z
ddlmZddl
mZdd
lmZddlmZddlmZdZdZdZddeed�Zddeed�Zd�Zedkre�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatust	communitytsupported_bys�
---
module: hipchat
version_added: "1.2"
short_description: Send a message to Hipchat.
description:
   - Send a message to a Hipchat room, with options to control the formatting.
options:
  token:
    description:
      - API token.
    required: true
  room:
    description:
      - ID or name of the room.
    required: true
  from:
    description:
      - Name the message will appear to be sent from. Max length is 15
        characters - above this it will be truncated.
    default: Ansible
  msg:
    description:
      - The message body.
    required: true
  color:
    description:
      - Background color for the message.
    default: yellow
    choices: [ "yellow", "red", "green", "purple", "gray", "random" ]
  msg_format:
    description:
      - Message format.
    default: text
    choices: [ "text", "html" ]
  notify:
    description:
      - If true, a notification will be triggered for users in the room.
    type: bool
    default: 'yes'
  validate_certs:
    description:
      - If C(no), SSL certificates will not be validated. This should only be used
        on personally controlled sites using self-signed certificates.
    type: bool
    default: 'yes'
    version_added: 1.5.1
  api:
    description:
      - API url if using a self-hosted hipchat server. For Hipchat API version
        2 use the default URI with C(/v2) instead of C(/v1).
    default: 'https://api.hipchat.com/v1'
    version_added: 1.6.0

author:
- Shirou Wakayama (@shirou)
- Paul Bourdel (@pb8226)
s�
- hipchat:
    room: notif
    msg: Ansible task finished

# Use Hipchat API version 2
- hipchat:
    api: https://api.hipchat.com/v2/
    token: OAUTH2_TOKEN
    room: notify
    msg: Ansible task finished
N(t
AnsibleModule(t	urlencode(tpathname2url(t	to_native(t	fetch_urlshttps://api.hipchat.com/v1s/rooms/messages/room/{id_or_name}/notificationttexttyellowc	C`s�i}	||	d<|d |	d<||	d<||	d<||	d<||	d<t|�|	d<|td	|}
t|	�}|jr�|jd
t�nt||
d|�\}}
|
dd
kr�|j�S|jddt	|
d��dS(s$sending message to hipchat v1 servertroom_iditfromtmessagetmessage_formattcolortapitnotifys?auth_token=%stchangedtdataRi�tmsgs(failed to send message, return status=%sN(
tintt
MSG_URI_V1R	t
check_modet	exit_jsontFalseRtreadt	fail_jsontstr(tmodulettokentroomtmsg_fromRt
msg_formatRRRtparamsturlRtresponsetinfo((sH/usr/lib/python2.7/site-packages/ansible/modules/notification/hipchat.pytsend_msg_v1ms 




	
c		C`s�id|d6dd6}	t�}
||
d<||
d<||
d<||
d<|t}|jd	t|��}tj|
�}
|jr�|jd
t�nt	||d|
d|	d
d�\}}|ddkr�|j
�S|jddt|d��dS(s$sending message to hipchat v2 servers	Bearer %st
Authorizationsapplication/jsonsContent-TypeRRRRs{id_or_name}RRtheaderstmethodtPOSTRi�i�Rs(failed to send message, return status=%sN(i�i�(
tdictt
NOTIFY_URI_V2treplaceR
tjsontdumpsRRRRRRR (R!R"R#R$RR%RRRR,tbodytPOST_URLR'RR(R)((sH/usr/lib/python2.7/site-packages/ansible/modules/notification/hipchat.pytsend_msg_v2�s	




	'
cC`stdtdtdtdt�dtdt�dtdt�dtdd	d
dg�dtdd
dd
dddddg�dtdddddg�dtdtdd�dtdddd�dtdt��	dt�}|jd}t|jd�}|jd}|jd}|jd}|jd}|jd}|jd}y`|jd�dkr�t|||||||||�	n"t|||||||||�	Wn9t	k
r�}	|j
dd t|	�d!tj
��nXt}
|jd"|
d|d|d|�dS(#Nt
argument_specR"trequiredtno_logR#RR$tdefaulttAnsibletaliasesRRRtchoicestredtgreentpurpletgraytrandomR%R
thtmlRttypetbooltvalidate_certstyesRtsupports_check_modes/v2i����sunable to send msg: %st	exceptionR(RR/tTruetDEFAULT_URIR&R tfindR6R*t	ExceptionRRt	tracebackt
format_excR(R!R"R#RR$RR%RRteR((sH/usr/lib/python2.7/site-packages/ansible/modules/notification/hipchat.pytmain�s:	






%&*t__main__(t
__future__RRRRDt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESR2RNtansible.module_utils.basicRt+ansible.module_utils.six.moves.urllib.parseR	t-ansible.module_utils.six.moves.urllib.requestR
tansible.module_utils._textRtansible.module_utils.urlsRRKRR0RR*R6RQt__name__(((sH/usr/lib/python2.7/site-packages/ansible/modules/notification/hipchat.pyt<module>s.


<
"	'

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]