AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.219.212.91
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/junit.pyo
�
��\c@`sNddlmZmZmZeZdZddlZddlZddl	Z	ddl
mZmZddl
mZy ddlmZmZeZWnek
r�eZnXyddlmZeZWnEek
r
yddlmZeZWqek
r	eZqXnXdefd	��YZd
dd��YZddd
��YZdS(i(tabsolute_importtdivisiontprint_functions�
    callback: junit
    type: aggregate
    short_description: write playbook output to a JUnit file.
    version_added: historical
    description:
      - This callback writes playbook output to a JUnit formatted XML file.
      - "Tasks show up in the report as follows:
        'ok': pass
        'failed' with 'EXPECTED FAILURE' in the task name: pass
        'failed' with 'TOGGLE RESULT' in the task name: pass
        'ok' with 'TOGGLE RESULT' in the task name: failure
        'failed' due to an exception: error
        'failed' for other reasons: failure
        'skipped': skipped"
    options:
      output_dir:
        name: JUnit output dir
        default: ~/.ansible.log
        description: Directory to write XML files to.
        env:
          - name: JUNIT_OUTPUT_DIR
      task_class:
        name: JUnit Task class
        default: False
        description: Configure the output to be one class per yaml file
        env:
          - name: JUNIT_TASK_CLASS
      fail_on_change:
        name: JUnit fail on change
        default: False
        description: Consider any tasks reporting "changed" as a junit test failure
        env:
          - name: JUNIT_FAIL_ON_CHANGE
      fail_on_ignore:
        name: JUnit fail on ignore
        default: False
        description: Consider failed tasks as a junit test failure even if ignore_on_error is set
        env:
          - name: JUNIT_FAIL_ON_IGNORE
      include_setup_tasks_in_report:
        name: JUnit include setup tasks in report
        default: True
        description: Should the setup tasks be included in the final report
        env:
          - name: JUNIT_INCLUDE_SETUP_TASKS_IN_REPORT
    requirements:
      - whitelist in configuration
      - junit_xml (python lib)
N(tto_bytestto_text(tCallbackBase(t	TestSuitetTestCase(tOrderedDicttCallbackModulecB`s�eZdZdZdZdZeZd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zed�Zd�Zd�Zd�Zd�ZRS(s
    This callback writes playbook output to a JUnit formatted XML file.

    Tasks show up in the report as follows:
        'ok': pass
        'failed' with 'EXPECTED FAILURE' in the task name: pass
        'failed' with 'TOGGLE RESULT' in the task name: pass
        'ok' with 'TOGGLE RESULT' in the task name: failure
        'failed' due to an exception: error
        'failed' for other reasons: failure
        'skipped': skipped

    This plugin makes use of the following environment variables:
        JUNIT_OUTPUT_DIR (optional): Directory to write XML files to.
                                     Default: ~/.ansible.log
        JUNIT_TASK_CLASS (optional): Configure the output to be one class per yaml file
                                     Default: False
        JUNIT_FAIL_ON_CHANGE (optional): Consider any tasks reporting "changed" as a junit test failure
                                     Default: False
        JUNIT_FAIL_ON_IGNORE (optional): Consider failed tasks as a junit test failure even if ignore_on_error is set
                                     Default: False
        JUNIT_INCLUDE_SETUP_TASKS_IN_REPORT (optional): Should the setup tasks be included in the final report
                                     Default: True

    Requires:
        junit_xml

    g@t	aggregatetjunitcC`sItt|�j�tjdtjjd��|_tjdd�j�|_	tjdd�j�|_
tjdd�j�|_tjdd�j�|_d|_d|_d|_d|_t|_ts�t|_|jjd	�ntrt�|_nt|_|jjd
�tjj|j�sEtj|j�ndS(NtJUNIT_OUTPUT_DIRs~/.ansible.logtJUNIT_TASK_CLASStFalsetJUNIT_FAIL_ON_CHANGEtJUNIT_FAIL_ON_IGNOREt#JUNIT_INCLUDE_SETUP_TASKS_IN_REPORTtTruesVThe `junit_xml` python module is not installed. Disabling the `junit` callback plugin.sXThe `ordereddict` python module is not installed. Disabling the `junit` callback plugin.(tsuperR	t__init__tostgetenvtpatht
expandusert_output_dirtlowert_task_classt_fail_on_changet_fail_on_ignoret_include_setup_tasks_in_reporttNonet_playbook_patht_playbook_namet
_play_namet
_task_dataRtdisabledt
HAS_JUNIT_XMLRt_displaytwarningtHAS_ORDERED_DICTRtexiststmkdir(tself((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyRvs(!							cC`s�|j}||jkrdS|j}|j�j�}|j�}|j}|js�djd�|j	j
�D��}|r�|d|7}q�nt|||||�|j|<dS(s2 record the start of a task for one or more hosts Ns, cs`s|]}d|VqdS(s%s=%sN((t.0ta((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pys	<genexpr>�st (t_uuidR#R"tget_nametstriptget_pathtactiontno_logtjointargstitemstTaskData(R+ttasktuuidtplaytnameRR3R6((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyt_start_task�s				"c	C`s|jj}t|d�r6|jj}|jj}nd}d}|j|}|jdkr�|dkr�|jjdt	�r�d}n|dkr�d|jkr�d}n<d|jkr�|dkr�d}q�|dkr�d}q�n|j
t||||��d	S(
s0 record the results of a task for a single host t_hosttincludettruetoktchangedtfailedsEXPECTED FAILUREs
TOGGLE RESULTN(t_taskR/thasattrR>R<R#Rt_resulttgetRtadd_hosttHostData(R+tstatustresultt	task_uuidt	host_uuidt	host_namet	task_data((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyt_finish_task�s"
0			cC`s�d|j|j|jf}|j|j}|jdkrVtjdd|j�}n	|j}|jdkr�t	||||j
�S|j
j}|jdd�}|j
|dd�}|j|�}|jd	kr�t	||||�St	|||�}	|jd
kr�d|krO|dj�jd�d
}
|d}|	j|
|�q�d|krx|d}
|	j|
|�q�|	jd||�n>|jdkr�d|kr�|d}
nd}
|	j|
�n|	S(s7 build a TestCase from the given TaskData and HostData s[%s] %s: %sR@s
\.yml:[0-9]+$ttincludedtrcitindentRARCt	exceptions
i����tmsgsrc=%stskippedtskip_reason(R<R;tfinishtstartRtretsubRRJRRKRFRGt
_dump_resultst_cleanse_stringR1tsplittadd_error_infotadd_failure_infotadd_skipped_info(R+ROt	host_dataR<tdurationtjunit_classnametresRStdumpt	test_casetmessagetoutput((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyt_build_test_case�s:	


cC`stt|dd�dd�S(s] convert surrogate escapes to the unicode replacement character to avoid XML encoding errors terrorstsurrogateescapetreplace(RR(R+tvalue((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyR^�sc
	C`sg}xz|jj�D]i\}}|jdkrF|jdkrFqnx6|jj�D]%\}}|j|j||��qVWqWt|j|�}tj	|g�}t
jj|j
d|jtj�f�}t|d�� }	|	jt|dd��WdQXdS(sF generate a TestSuite report from the collected TaskData and HostData tsetuptfalses	%s-%s.xmltwbRltsurrogate_or_strictN(R#R7R3RRctappendRkRR!t
to_xml_stringRRR5RttimetopentwriteR(
R+t
test_casesRLRORMRct
test_suitetreporttoutput_filetxml((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyt_generate_report�s!+cC`s8|j|_tjjtjj|j��d|_dS(Ni(t
_file_nameR RRtsplitexttbasenameR!(R+tplaybook((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pytv2_playbook_on_startscC`s|j�|_dS(N(R0R"(R+R;((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pytv2_playbook_on_play_startscC`s|j|�dS(N(R=(R+R9((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pytv2_runner_on_no_hostsscC`s|j|�dS(N(R=(R+R9tis_conditional((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pytv2_playbook_on_task_startscC`s|j|�dS(N(R=(R+R9((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyt!v2_playbook_on_cleanup_task_startscC`s|j|�dS(N(R=(R+R9((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyt!v2_playbook_on_handler_task_startscC`s<|r(|jdkr(|jd|�n|jd|�dS(NR@RARC(RRP(R+RKt
ignore_errors((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pytv2_runner_on_failedscC`s|jd|�dS(NRA(RP(R+RK((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pytv2_runner_on_ok scC`s|jd|�dS(NRW(RP(R+RK((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pytv2_runner_on_skipped#scC`s|jd|�dS(NRR(RP(R+t
included_file((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pytv2_playbook_on_include&scC`s|j�dS(N(R~(R+tstats((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pytv2_playbook_on_stats)s(t__name__t
__module__t__doc__tCALLBACK_VERSIONt
CALLBACK_TYPEt
CALLBACK_NAMERtCALLBACK_NEEDS_WHITELISTRR=RPRkR^R~R�R�R�R�R�R�RR�R�R�R�R�(((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyR	Ss,				+											R8cB`s eZdZd�Zd�ZRS(s(
    Data about an individual task.
    cC`sU||_||_||_||_d|_t�|_tj�|_||_	dS(N(
R:R<RR;RRZRRcRvR3(R+R:R<RR;R3((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyR2s					cC`s�|j|jkrr|jdkrGd|j|jj|jf|_qrtd|j|j|j|jf��n||j|j<dS(NRRs%s
%ss'%s: %s: %s: duplicate host callback: %s(R:RcRJRKt	ExceptionRR;R<(R+thost((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyRH<s
&+(R�R�R�RRH(((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyR8-s	
RIcB`seZdZd�ZRS(s(
    Data about an individual host.
    cC`s7||_||_||_||_tj�|_dS(N(R:R<RJRKRvRY(R+R:R<RJRK((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyRLs
				(R�R�R�R(((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyRIGs(((t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONRRvR[tansible.module_utils._textRRtansible.plugins.callbackRt	junit_xmlRRRR%tImportErrorRtcollectionsRR(tordereddictR	R8RI(((sB/usr/lib/python2.7/site-packages/ansible/plugins/callback/junit.pyt<module>s03






�

Anon7 - 2022
AnonSec Team