Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	y ddl
mZmZe
ZWnek
r�eZnXddlmZdd
lmZd�Zd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatust	communitytsupported_bys�
module: bearychat
short_description: Send BearyChat notifications
description:
    - The M(bearychat) module sends notifications to U(https://bearychat.com)
      via the Incoming Robot integration.
version_added: "2.4"
author: "Jiangge Zhang (@tonyseek)"
options:
  url:
    description:
      - BearyChat WebHook URL. This authenticates you to the bearychat
        service. It looks like
        C(https://hook.bearychat.com/=ae2CF/incoming/e61bd5c57b164e04b11ac02e66f47f60).
    required: true
  text:
    description:
      - Message to send.
  markdown:
    description:
      - If C(yes), text will be parsed as markdown.
    default: 'yes'
    type: bool
  channel:
    description:
      - Channel to send the message to. If absent, the message goes to the
        default channel selected by the I(url).
  attachments:
    description:
      - Define a list of attachments. For more information, see
        https://github.com/bearyinnovative/bearychat-tutorial/blob/master/robots/incoming.md#attachments
s�
- name: Send notification message via BearyChat
  local_action:
    module: bearychat
    url: |
      https://hook.bearychat.com/=ae2CF/incoming/e61bd5c57b164e04b11ac02e66f47f60
    text: "{{ inventory_hostname }} completed"

- name: Send notification message via BearyChat all options
  local_action:
    module: bearychat
    url: |
      https://hook.bearychat.com/=ae2CF/incoming/e61bd5c57b164e04b11ac02e66f47f60
    text: "{{ inventory_hostname }} completed"
    markdown: no
    channel: "#ansible"
    attachments:
      - title: "Ansible on {{ inventory_hostname }}"
        text: "May the Force be with you."
        color: "#ffffff"
        images:
          - http://example.com/index.png
s]
msg:
    description: execution result
    returned: success
    type: str
    sample: "OK"
(turlparset
urlunparse(t
AnsibleModule(t	fetch_urlc`s�i}|dk	r||d<n|dk	r8||d<n|dk	rQ||d<n|dk	r�|jdg�j�fd�|D��nd�j|�}|S(Nttexttmarkdowntchanneltattachmentsc3`sK|]A}t�|jd�|jd�|jd�|jd��VqdS(ttitleRtcolortimagesN(t&build_payload_for_bearychat_attachmenttget(t.0titem(tmodule(sJ/usr/lib/python2.7/site-packages/ansible/modules/notification/bearychat.pys	<genexpr>pss
payload=%s(tNonet
setdefaulttextendtjsonify(RRR
RRtpayload((RsJ/usr/lib/python2.7/site-packages/ansible/modules/notification/bearychat.pytbuild_payload_for_bearychatfs


cC`s"i}|dk	r||d<n|dk	r8||d<n|dk	rQ||d<n|dk	r|jdg�}t|ttf�s�|g}nx�|D]�}t|t�r�d|kr�i|dd6}n>t|d�r�|jd�r�i|d6}n|jdd	�|j	|�q�Wn|S(
NRRRRturlt
startswiththttptmsgs@BearyChat doesn't have support for this kind of attachment image(
RRt
isinstancetlistttupletdictthasattrRt	fail_jsontappend(RRRRRt
attachmentt
target_imagestimage((sJ/usr/lib/python2.7/site-packages/ansible/modules/notification/bearychat.pyRxs(



	cC`s�t||d|�\}}|ddkrt|�}t|j|jddddf�}|jdd|||df�ndS(NtdataRi�s
[obscured]tR!s failed to send %s to %s: %s(RRR	tschemetnetlocR'(RRRtresponsetinfoturl_infotobscured_incoming_webhook((sJ/usr/lib/python2.7/site-packages/ansible/modules/notification/bearychat.pytdo_notify_bearychat�s!	c
C`stditdddtdt�d6tdd�d6tdd	dd
�d6tdd�d6tdd
�d6�}ts�|jdd�n|jd}|jd}|jd}|jd}|jd}t|||||�}t|||�|jdd�dS(Nt
argument_specttypetstrtrequiredtno_logRRtdefaulttyestboolR
RR#RR!surlparse is not installedtOK(	R
R%tTruetHAS_URLPARSER'tparamsRR4t	exit_json(RRRR
RRR((sJ/usr/lib/python2.7/site-packages/ansible/modules/notification/bearychat.pytmain�s"	




t__main__N(t
__future__RRRR6t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNt+ansible.module_utils.six.moves.urllib.parseRR	R>R?t	ExceptiontFalsetansible.module_utils.basicR
tansible.module_utils.urlsRRRR4RBt__name__(((sJ/usr/lib/python2.7/site-packages/ansible/modules/notification/bearychat.pyt<module>s(


!


				

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