Dashboard
PHP:
8.2.30
OS:
Linux
User:
dh_nv8b2m
/
/
usr
/
local
/
lib
/
python3.10
/
dist-packages
/
ansible
/
plugins
/
callback
/
__pycache__
📤 Upload
📝 New File
📁 New Folder
Close
Editing: junit.cpython-310.pyc
o O�h�5 � @ s� d dl mZ dZd dlZd dlZd dlZd dlmZ d dl m Z mZ d dlm Z d dlmZmZmZmZmZ G dd � d e �ZG d d� d�ZG dd � d �ZdS )� )�annotationsa name: 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 task_relative_path: name: JUnit Task relative path default: none description: Configure the output to use relative paths to given directory version_added: "2.8" env: - name: JUNIT_TASK_RELATIVE_PATH replace_out_of_tree_path: name: Replace out of tree path default: none description: Replace the directory portion of an out-of-tree relative task path with the given placeholder version_added: "2.12.3" env: - name: JUNIT_REPLACE_OUT_OF_TREE_PATH 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 hide_task_arguments: name: Hide the arguments for a task default: False description: Hide the arguments for a task version_added: "2.8" env: - name: JUNIT_HIDE_TASK_ARGUMENTS test_case_prefix: name: Prefix to find actual test cases default: <empty> description: Consider a task only as test case if it has this value as prefix. Additionally failing tasks are recorded as failed test cases. version_added: "2.8" env: - name: JUNIT_TEST_CASE_PREFIX requirements: - enable in configuration N)� constants)�to_bytes�to_text)�CallbackBase)�TestCase� TestError�TestFailure� TestSuite� TestSuitesc s� e Zd ZdZdZdZdZdZ� fdd�Zdd � Z d d� Z dd � Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd)dd �Zd!d"� Zd#d$� Zd%d&� Zd'd(� Z� ZS )*�CallbackModulea 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_TASK_RELATIVE_PATH (optional): Configure the output to use relative paths to given directory Default: none 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 JUNIT_HIDE_TASK_ARGUMENTS (optional): Hide the arguments for a task Default: False JUNIT_TEST_CASE_PREFIX (optional): Consider a task only as test case if it has this value as prefix. Additionally failing tasks are recorded as failed test cases. Default: <empty> g @� aggregate�junitTc s t t| ��� t�dtj�d��| _t�dd��� | _ t�dd�| _ t�dd��� | _t�dd��� | _t�d d ��� | _ t�dd��� | _t�dd�| _t�d d �| _d | _d | _d | _d | _d| _i | _| jd urqt| j�| _tj�| j�s�t�| j� d S d S )N�JUNIT_OUTPUT_DIRz~/.ansible.log�JUNIT_TASK_CLASS�False�JUNIT_TASK_RELATIVE_PATH� �JUNIT_FAIL_ON_CHANGE�JUNIT_FAIL_ON_IGNORE�#JUNIT_INCLUDE_SETUP_TASKS_IN_REPORT�True�JUNIT_HIDE_TASK_ARGUMENTS�JUNIT_TEST_CASE_PREFIX�JUNIT_REPLACE_OUT_OF_TREE_PATHF)�superr �__init__�os�getenv�path� expanduser�_output_dir�lower�_task_class�_task_relative_path�_fail_on_change�_fail_on_ignore�_include_setup_tasks_in_report�_hide_task_arguments�_test_case_prefix�_replace_out_of_tree_path�_playbook_path�_playbook_name� _play_name� _task_data�disabledr �exists�makedirs)�self�� __class__� �I/usr/local/lib/python3.10/dist-packages/ansible/plugins/callback/junit.pyr � s* �zCallbackModule.__init__c C s� |j }|| jv r dS | j}|�� �� }|�� }|j}|js7| jdkr7d� dd� |j �� D ��}|r7|d| 7 }t|||||�| j|<