File: //lib/python3.9/site-packages/ansible/plugins/callback/__pycache__/oneline.cpython-39.pyc
a
�)g�
� @ sH d dl mZmZmZ eZdZd dlmZ d dl m
Z G dd� de�ZdS )� )�absolute_import�division�print_functionz�
name: oneline
type: stdout
short_description: oneline Ansible screen output
version_added: historical
description:
- This is the output callback used by the -o/--one-line command line option.
)�CallbackBase)� constantsc @ sF e Zd ZdZdZdZdZdd� Zddd �Zd
d� Z dd
� Z
dd� ZdS )�CallbackModulez�
This is the default callback interface, which simply prints messages
to stdout when new callback events are received.
g @�stdoutZonelinec C s~ |� dd��dd��dd�}d|v rb|d rb|� dd��dd��dd�}d|||� d d
�||f S d|||� d d
�|f S d S )Nr � �
z\n�
z\r�stderrz)%s | %s | rc=%s | (stdout) %s (stderr) %s�rc���z%s | %s | rc=%s | (stdout) %s)�get�replace)�self�hostname�resultZcaptionr r � r �D/usr/lib/python3.9/site-packages/ansible/plugins/callback/oneline.py�_command_generic_msg! s
z#CallbackModule._command_generic_msgFc C s� d|j v r�| jjdk r8|j d �� �d�d }d| }nd|j d �dd� }|jjtj v r�d|j vr�| jj
| �|j�
� |j d �tjd
� n| jj
|tjd
� | jj
d|j�
� | j|j dd
��dd�f tjd
� d S )N� exception� r
r zcAn exception occurred during task execution. To see the full traceback, use -vvv. The error was: %szDAn exception occurred during task execution. The full traceback is:
r Z
module_stderrZFAILED��colorz%s | FAILED! => %sr ��indent)�_result�_display� verbosity�strip�splitr �_task�action�C�MODULE_NO_JSON�displayr �_host�get_nameZCOLOR_ERROR�
_dump_results)r r �
ignore_errors�error�msgr r r �v2_runner_on_failed) s
&*�z"CallbackModule.v2_runner_on_failedc C s� |j �dd�rtj}d}n
tj}d}|jjtjv r`d|j vr`| jj | �
|j�� |j |�|d� n4| jj d|j�� || j
|j dd ��d
d�f |d� d S )NZchangedFZCHANGED�SUCCESSZansible_job_idr z
%s | %s => %sr r r
r )r r r$ Z
COLOR_CHANGEDZCOLOR_OKr"