AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.221.73.212
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/979/cwd/lib/python2.7/site-packages/ansible/plugins/callback/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /proc/979/cwd/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.pyo
�
��\c@`s�ddlmZmZmZeZdZddlZddlZyddl	Z	e
ZWnek
roe
ZnXddlmZddlmZddlmZdefd��YZdS(	i(tabsolute_importtdivisiontprint_functions�
    callback: hipchat
    callback_type: notification
    requirements:
      - whitelist in configuration.
      - prettytable (python lib)
    short_description: post task events to hipchat
    description:
      - This callback plugin sends status updates to a HipChat channel during playbook execution.
      - Before 2.4 only environment variables were available for configuring this plugin.
    version_added: "1.6"
    options:
      token:
        description: HipChat API token for v1 or v2 API.
        required: True
        env:
          - name: HIPCHAT_TOKEN
        ini:
          - section: callback_hipchat
            key: token
      api_version:
        description: HipChat API version, v1 or v2.
        required: False
        default: v1
        env:
          - name: HIPCHAT_API_VERSION
        ini:
          - section: callback_hipchat
            key: api_version
      room:
        description: HipChat room to post in.
        default: ansible
        env:
          - name: HIPCHAT_ROOM
        ini:
          - section: callback_hipchat
            key: room
      from:
        description:  Name to post as
        default: ansible
        env:
          - name: HIPCHAT_FROM
        ini:
          - section: callback_hipchat
            key: from
      notify:
        description: Add notify flag to important messages
        type: bool
        default: True
        env:
          - name: HIPCHAT_NOTIFY
        ini:
          - section: callback_hipchat
            key: notify

N(tCallbackBase(t	urlencode(topen_urltCallbackModulecB`s�eZdZdZdZdZeZdZdZ	d�Z
dddd�Zdd	e
d
�Zdd	e
d�Zd�Zd
�ZRS(s}This is an example ansible callback plugin that sends status
    updates to a HipChat channel during playbook execution.
    g@tnotificationthipchats(https://api.hipchat.com/v1/rooms/messageshttps://api.hipchat.com/v2/cC`sTtt|�j�ts5t|_|jjd�nt|_	d|_d|_dS(NsXThe `prettytable` python module is not installed. Disabling the HipChat callback plugin.(
tsuperRt__init__tHAS_PRETTYTABLEtTruetdisabledt_displaytwarningtFalsetprinted_playbooktNonet
playbook_nametplay(tself((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.pyR
\s			cC`s�tt|�jd|d|d|�|jd�|_|jd�|_|jd�|_|jd�|_|jd�|_|jdkr�t
|_|jj
d	�n|jd
kr�|j|_n|j|_dS(Nt	task_keystvar_optionstdirectttokentapi_versiontfromtnotifytroomstHipChat token could not be loaded. The HipChat token can be provided using the `HIPCHAT_TOKEN` environment variable.tv2(R	Rtset_optionst
get_optionRRt	from_nametallow_notifyRRRR
RRtsend_msg_v2tsend_msgtsend_msg_v1(RRRR((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.pyRhs%	ttexttyellowc	C`s�id|jd6dd6}i}|j|d<|jd |d<||d<||d	<||d
<|joi||d<tj|�}|jdjd|j�}y,t|d
|d|dd�}	|	j	�SWn,t
k
r�}
|jjdj|
��nXdS(s'Method for sending a message to HipChats	Bearer %st
Authorizationsapplication/jsonsContent-Typetroom_idiRtmessagetmessage_formattcolorRsroom/{room_id}/notificationtdatatheaderstmethodtPOSTs(Could not submit message to hipchat: {0}N(
RRR!R"tjsontdumpst
API_V2_URLtformatRtreadt	ExceptionRR(Rtmsgt
msg_formatR,RR.tbodyR-turltresponsetex((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.pyR#}s



c	C`s�i}|j|d<|jd |d<||d<||d<||d<t|joQ|�|d<d|j|jf}y&t|d	t|��}|j�SWn,t	k
r�}|j
jd
j|��nXdS(s'Method for sending a message to HipChatR)iRR*R+R,Rs%s?auth_token=%sR-s(Could not submit message to hipchat: {0}N(
RR!tintR"t
API_V1_URLRRRR5R6RRR4(	RR7R8R,RtparamsR:R;R<((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.pyR%�s



cC`sN||_|j}|js0tjjtjj|jjj��\|_	}|jjj
j}tjjtjj|��}|j
d|j	|jjj|fdt�t|_|jjj
j}|jjj}|j
d|j	dj|jjj�|r
dj|�nd|r"dj|�n|f�n|j
d|j	|f�dS(s(Display Playbook and play start messagess'%s: Playbook initiated by %s against %sRs$%s:
Tags: %s
Skip Tags: %s
Limit: %ss, s%s: Starting play: %sN(RtnameRtostpathtsplitexttbasenametplaybooktfilenameRt	inventoryt	host_listtrealpathR$tremote_userRt_subsett	skip_tagstjoint	only_tagsR(RRR@t_RHRGtsubsetRL((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.pytv2_playbook_on_play_start�s*				'			#	c
C`sAt|jj��}tjdddddg�}t}t}x�|D]~}|j|�}|ddkrtt}n|ddkr�t}n|j|ggd	d
ddgD]}||^q��qFW|j	d|j
dt�|s�|rd
}	|j	d|j
d|	dt�nd}	|j	d|j
|fd|	�dS(s&Display info about playbook statisticstHosttOktChangedtUnreachabletFailurestfailuresitunreachabletoktchangeds%s: Playbook completeRtreds%s: Failures detectedR,tgreens/code %s:
%sN(tsortedt	processedtkeystprettytabletPrettyTableRt	summarizeRtadd_rowR$R(
RtstatsthoststtRWRXthtstkR,((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.pytplaybook_on_stats�s*
		#N(t__name__t
__module__t__doc__tCALLBACK_VERSIONt
CALLBACK_TYPEt
CALLBACK_NAMERtCALLBACK_NEEDS_WHITELISTR>R3R
RRRR#R%RQRj(((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.pyROs		!(t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONRAR1R`RRtImportErrorRtansible.plugins.callbackRt+ansible.module_utils.six.moves.urllib.parseRtansible.module_utils.urlsRR(((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/hipchat.pyt<module>s9




Anon7 - 2022
AnonSec Team