AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.227.190.202
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 :  /lib/python2.7/site-packages/ansible/plugins/callback/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyc
�
��\c@`s�ddlmZmZmZeZdZddlZddlmZddl	m
Z
ddlZddlZyddl
Z
eZWnek
r�eZnXddlmZdefd��YZdS(	i(tabsolute_importtdivisiontprint_functions�
    callback: foreman
    type: notification
    short_description: Sends events to Foreman
    description:
      - This callback will report facts and task events to Foreman https://theforeman.org/
      - 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 foreman.ini
      - In 2.4 and above you can just put it in the main Ansible configuration file.
    version_added: "2.2"
    requirements:
      - whitelisting in configuration
      - requests (python library)
    options:
      url:
        description: URL to the Foreman server
        env:
          - name: FOREMAN_URL
        required: True
        default: http://localhost:3000
        ini:
          - section: callback_foreman
            key: url
      ssl_cert:
        description: X509 certificate to authenticate to Foreman if https is used
        env:
            - name: FOREMAN_SSL_CERT
        default: /etc/foreman/client_cert.pem
        ini:
          - section: callback_foreman
            key: ssl_cert
      ssl_key:
        description: the corresponding private key
        env:
          - name: FOREMAN_SSL_KEY
        default: /etc/foreman/client_key.pem
        ini:
          - section: callback_foreman
            key: ssl_key
      verify_certs:
        description:
          - Toggle to decidewhether to verify the Foreman certificate.
          - It can be set to '1' to verify SSL certificates using the installed CAs or to a path pointing to a CA bundle.
          - Set to '0' to disable certificate checking.
        env:
          - name: FOREMAN_SSL_VERIFY
        default: 1
        ini:
          - section: callback_foreman
            key: verify_certs
N(tdatetime(tdefaultdict(tCallbackBasetCallbackModulecB`s�eZdZdZdZeZidd6dd6ZdZd�Z	dddd�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zed�Zd�Zd�Zd�Zd�Zd�ZRS(g@tnotificationtforemansapplication/jsonsContent-TypetAccepts%Y-%m-%d %H:%M:%S %fcC`s;tt|�j�tt�|_ttj��|_dS(N(	tsuperRt__init__Rtlisttitemstintttimet
start_time(tself((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyRXscC`sNtt|�jd|d|d|�|jd�|_|jd�|jd�f|_t|jd��|_|j�|_	t
r�ttj
jd�d	�}|d
kr�|jd�q�n
|jd�|jjd
�rJtjj|jd	�s|jd|jd	�ntjj|jd�sJ|jd|jd�qJndS(Nt	task_keystvar_optionstdirectturltssl_certtssl_keytverify_certst.iis(The `requests` python module is too old.s.The `requests` python module is not installed.shttps://sFOREMAN_SSL_CERT %s not found.isFOREMAN_SSL_KEY %s not found.(R
Rtset_optionst
get_optiontFOREMAN_URLtFOREMAN_SSL_CERTtstrtFOREMAN_SSL_VERIFYt_ssl_verifyt
ssl_verifytHAS_REQUESTSRtrequestst__version__tsplitt_disable_plugint
startswithtostpathtexists(RRRRtrequests_major((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyR]s%!
cC`s:t|_|r&|jj|d�n|jjd�dS(Ns' Disabling the Foreman callback plugin.s&Disabling the Foreman callback plugin.(tTruetdisabledt_displaytwarning(Rtmsg((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyR&us	cC`sp|jj�dkrt}nN|jj�d	krctjjj�|jjd|j	�t
}n	|j}|S(
Nt1ttruetont0tfalsetoffsSSL verification of %s disabled(R1R2R3(R4R5R6(RtlowerR,R#tpackagesturllib3tdisable_warningsR.R/RtFalse(Rtverify((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyR |s			cC`s�d|d<tj�j|j�|d<i|d6|d6}yQtjd|jddtj|�d	|j	d
|j
d|j�}|j�Wn)tj
jk
r�}tt|��nXdS(
s�
        Sends facts to Foreman, to be parsed by foreman_ansible fact
        parser.  The default fact importer should import these facts
        properly.
        tansiblet_typet
_timestamptnametfactsRs/api/v2/hosts/factstdatatheaderstcertR<N(RtnowtstrftimetTIME_FORMATR#tpostRtjsontdumpstFOREMAN_HEADERSRR!traise_for_statust
exceptionstRequestExceptiontprintR(RthostRBRAtrterr((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyt
send_facts�s


		cC`s�g}x�|D]�}|\}}d|kr4d}n%d|krS|drSd}nd}|jiii|d6d6itj|�d6d	6|d
6d6�q
W|S(NtfailedRRtchangedtnoticetinfotsourcetsourcestmessagetmessagestleveltlog(tappendRIRJ(RRBtlogstentryRXR0R\((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyt
_build_log�s 
			cC`s�td��}i}xd|jj�D]S}|j|�}|d|d<|d|d|d<|d|d<|j|j|�}ittj��|jd6|d	<t	j
�j|j�}ii|d
6|d6|d6|d
6|d6d6}yQt
jd|jddtj|�d|jd|jd|j�}	|	j�Wn)t
jjk
rj}
tt|
��nXg|j|<q%WdS(s�
        Send reports to Foreman to be parsed by its config report
        importer. THe data is in a format that Foreman can handle
        without writing another report importer.
        cS`sdS(Ni((((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyt<lambda>�sRUtappliedtfailurestunreachableRTtskippedttotalRRPtreported_attmetricststatusR_treportRs/api/v2/reportsRBRCRDR<N(Rt	processedtkeyst	summarizeRaR
RRRRRERFRGR#RHRRIRJRKRR!RLRMRNROR(RtstatsRjRiRPtsumR]RERkRQRR((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pytsend_reports�s6$		cC`s?|jj�}|jj�}|j|j||jf�dS(N(t_tasktget_namet_hostR
R^t_result(RtresultR@RP((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyt
append_result�scC`s|j|�dS(N(Rw(RRvt
ignore_errors((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pytv2_runner_on_failed�scC`s|j|�dS(N(Rw(RRv((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pytv2_runner_on_unreachable�scC`s|j|�dS(N(Rw(RRvtjid((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pytv2_runner_on_async_ok�scC`s|j|�dS(N(Rw(RRvR{((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pytv2_runner_on_async_failed�scC`s|j|�dS(N(Rq(RRo((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pytv2_playbook_on_stats�scC`s`|j}|jj}|dks-d|krO|jj�}|j||�n
|j|�dS(Ntsetupt
ansible_facts(RuRrtactionRtRsRSRw(RRvtrestmoduleRP((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pytv2_runner_on_ok�s	N(t__name__t
__module__tCALLBACK_VERSIONt
CALLBACK_TYPEt
CALLBACK_NAMER,tCALLBACK_NEEDS_WHITELISTRKRGRtNoneRR&R RSRaRqRwR;RyRzR|R}R~R�(((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyRLs,
						(					(t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONR(RtcollectionsRRIRR#R,R"tImportErrorR;tansible.plugins.callbackRR(((sD/usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.pyt<module>s3




Anon7 - 2022
AnonSec Team