Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/plugins/callback/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyo

�
�Udac@`srddlmZmZmZeZdZdZddlZddl	Z	ddl
Z
ddlZddlZyddl
Z
eZWnek
r�eZnXyddlZeZWnek
r�eZnXddlmZmZddlmZdefd��YZyddlZeZWnek
r;eZeZnXd	efd
��YZeZdefd��YZdS(
i(tabsolute_importtdivisiontprint_functions
    callback: logentries
    type: notification
    short_description: Sends events to Logentries
    description:
      - This callback plugin will generate JSON objects and send them to Logentries via TCP for auditing/debugging purposes.
      - Before 2.4, if you wanted to use an ini configuration, the file must be placed in the same directory as this plugin and named logentries.ini
      - In 2.4 and above you can just put it in the main Ansible configuration file.
    version_added: "2.0"
    requirements:
      - whitelisting in configuration
      - certifi (python library)
      - flatdict (python library), if you want to use the 'flatten' option
    options:
      api:
        description: URI to the Logentries API
        env:
          - name: LOGENTRIES_API
        default: data.logentries.com
        ini:
          - section: callback_logentries
            key: api
      port:
        description: HTTP port to use when connecting to the API
        env:
            - name: LOGENTRIES_PORT
        default: 80
        ini:
          - section: callback_logentries
            key: port
      tls_port:
        description: Port to use when connecting to the API when TLS is enabled
        env:
            - name: LOGENTRIES_TLS_PORT
        default: 443
        ini:
          - section: callback_logentries
            key: tls_port
      token:
        description: The logentries "TCP token"
        env:
          - name: LOGENTRIES_ANSIBLE_TOKEN
        required: True
        ini:
          - section: callback_logentries
            key: token
      use_tls:
        description:
          - Toggle to decide whether to use TLS to encrypt the communications with the API server
        env:
          - name: LOGENTRIES_USE_TLS
        default: False
        type: boolean
        ini:
          - section: callback_logentries
            key: use_tls
      flatten:
        description: flatten complex data structures into a single dictionary with complex keys
        type: boolean
        default: False
        env:
          - name: LOGENTRIES_FLATTEN
        ini:
          - section: callback_logentries
            key: flatten
s 
examples: >
  To enable, add this to your ansible.cfg file in the defaults block

    [defaults]
    callback_whitelist = logentries

  Either set the environment variables
    export LOGENTRIES_API=data.logentries.com
    export LOGENTRIES_PORT=10000
    export LOGENTRIES_ANSIBLE_TOKEN=dd21fc88-f00a-43ff-b977-e3a4233c53af

  Or in the main Ansible config file
    [callback_logentries]
    api = data.logentries.com
    port = 10000
    tls_port = 20000
    use_tls = no
    token = dd21fc88-f00a-43ff-b977-e3a4233c53af
    flatten = False
N(tto_bytestto_text(tCallbackBasetPlainTextSocketAppendercB`s>eZdddd�Zd�Zd�Zd�Zd�ZRS(sdata.logentries.comiPi�cC`sU||_||_||_d|_d|_d|_d|_||_d|_	dS(Ng�������?i
sG

It appears the LOGENTRIES_TOKEN parameter you entered is incorrect!

u
(
tLE_APItLE_PORTtLE_TLS_PORTt	MIN_DELAYt	MAX_DELAYt
INVALID_TOKENtLINE_SEPt_displaytNonet_conn(tselftdisplayRRR	((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyt__init__zs								cC`s;tjtjtj�|_|jj|j|jf�dS(N(tsockettAF_INETtSOCK_STREAMRtconnectRR(R((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytopen_connection�scC`s�|j�|j}x�tr�y|j�dSWn-tk
r]}|jjdt|��nX|d9}||jkr�|j}n|t	j
d|�}y%|jjd|�tj|�Wqt
k
r��qXqWdS(Nu#Unable to connect to Logentries: %siissleeping %s before retry(tclose_connectionR
tTrueRt	ExceptionRtvvvvRRtrandomtuniformttimetsleeptKeyboardInterrupt(Rt
root_delaytetwait_for((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytreopen_connection�s"
		


cC`s#|jdk	r|jj�ndS(N(RRtclose(R((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyR�scC`s�t|dd�}|jd|j�}|d7}xOtr�y |jjt|dd��Wn!tjk
r}|j	�q4nXPq4W|j
�dS(Nterrorstsurrogate_or_strictu
(RtreplaceR
RRtsendRRterrorR%R(Rtdatat	multiline((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytput�s
	 
(t__name__t
__module__RRR%RR.(((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyRys
			tTLSSocketAppendercB`seZd�ZRS(cC`s�tjtjtj�}tjd|dddddtdtjdttdtj	�dt
j�d	td
t�	}|j
|j|jf�||_dS(Ntsocktkeyfiletcertfiletserver_sidet	cert_reqstssl_versiontPROTOCOL_TLSv1_2tca_certstdo_handshake_on_connecttsuppress_ragged_eofs(RRRtssltwrap_socketRtFalset
CERT_REQUIREDtgetattrtPROTOCOL_TLSv1tcertifitwhereRRRR	R(RR2((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyR�s			(R/R0R(((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyR1�stCallbackModulecB`s�eZdZdZdZeZd�Zdddd�Z	d�Z
d�Zd�Zd�Z
d	�Zed
�Zdd�Zd�Zd
�Zd�Zd�ZRS(g@tnotificationt
logentriescC`sptt|�j�ts,|jjd�ntsNt|_|jjd�nt	t
j��|_d|_
dS(Ns4Unable to import ssl module. Will send over port 80.sWThe `certifi` python module is not installed.
Disabling the Logentries callback plugin.i
(tsuperRDRtHAS_SSLRtwarningtHAS_CERTIFIRtdisabledtstrtuuidtuuid4tle_jobidttimeout(R((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyR�s	cC`s;tt|�jd|d|d|�y^|jd�|_|jd�|_|jd�|_|jd�|_|jd�|_Wn6t	k
r�}|j
jd	t|��t
|_nXy|jd
�|_Wn,t	k
r}|j
jd�t
|_nX|jr-tr-t
|_|j
jd�n|j�dS(
Nt	task_keystvar_optionstdirecttapitportttls_porttuse_tlstflattenu1Missing option for Logentries callback plugin: %sttokens[Logentries token was not provided, this is required for this callback to operate, disablingswYou have chosen to flatten and the `flatdict` python module is not installed.
Disabling the Logentries callback plugin.(RGRDtset_optionst
get_optiontapi_urltapi_porttapi_tls_portRWRXtKeyErrorRRIRRRKRYtHAS_FLATDICTt_initialize_connections(RRQRRRSR#((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyRZ�s&%

	cC`s�|js�|jr\|jjd|j|jf�td|jd|jd|j�|_nG|jjd|j|jf�t	d|jd|jd|j�|_|jj
�ndS(NsConnecting to %s:%s with TLSRRR	sConnecting to %s:%sR(RKRWRRR\R^R1t	_appenderR]RR%(R((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyRa	s		 * 'cC`sK|jr1tj|�}|j|j|��n|j|j|��dS(N(RXtflatdicttFlatDicttemitt
_dump_results(Rtrecordtresults((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytemit_formatteds	cC`sH|jd�}dj|j|�}|jj|�|jjd�dS(Ns
s{0} {1}sSent event to logentries(trstriptformatRYRbR.RR(RRgtmsg((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyRescC`si|jd6|d6|d6S(NROthostnameRh(RO(Rthosttres((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyt	_set_info!scC`s-|j||�}d|d<|j|�dS(NtOKtstatus(RpRi(RRnRoRh((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytrunner_on_ok$s
cC`s-|j||�}d|d<|j|�dS(NtFAILEDRr(RpRi(RRnRot
ignore_errorsRh((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytrunner_on_failed)s
cC`s4|j||�}|d=d|d<|j|�dS(NRhtSKIPPEDRr(RpRi(RRntitemRh((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytrunner_on_skipped.s
cC`s-|j||�}d|d<|j|�dS(NtUNREACHABLERr(RpRi(RRnRoRh((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytrunner_on_unreachable4s
cC`s7|j||�}||d<d|d<|j|�dS(NtjidtASYNC_FAILEDRr(RpRi(RRnRoR|Rh((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytrunner_on_async_failed9s

cC`sZi}|j|d<tj�|d<|jr<|j|d<n|j|d<|j|�dS(NROt
started_bytplaythosts(ROtostgetlogintnameR�Ri(RR�Rh((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytv2_playbook_on_play_start?s
	
cC`s|jj�dS(s close connection N(RbR(Rtstats((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pytplaybook_on_statsHsN(R/R0tCALLBACK_VERSIONt
CALLBACK_TYPEt
CALLBACK_NAMERtCALLBACK_NEEDS_WHITELISTRRRZRaRiReRpRsR>RvRyR{R~R�R�(((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyRD�s"										( t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONtEXAMPLESR�RRRRMRBRRJtImportErrorR>RcR`tansible.module_utils._textRRtansible.plugins.callbackRtobjectRR<RHtSocketAppenderR1RD(((sG/usr/lib/python2.7/site-packages/ansible/plugins/callback/logentries.pyt<module>s<C





A




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