?????????? ????????? - ??????????????? - /usr/lib/python3.9/site-packages/ansible/cli/scripts/__pycache__/ansible_connection_cli_stub.cpython-39.pyc
???????
a �)g�4 � @ sp d dl mZmZmZ eZd dlZd dlZd dlZd dl Z d dl Z d dlZd dlZd dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dlmZmZ d dlmZm Z m!Z!m"Z" d dl#m$Z$ d d l%m&Z&m'Z' d d l(m)Z) d dl*m+Z+ d dl,m-Z-m.Z. d d l/m0Z0 d dl1m2Z2 e0� Z3dd� Z4edd� �Z5G dd� de6�Z7ddd�Z8e9dk�rle8� dS )� )�absolute_import�division�print_functionN)�contextmanager)� constants)�option_helpers)�to_bytes�to_text)� Connection�ConnectionError� send_data� recv_data)�fork_process)�AnsibleJSONEncoder�AnsibleJSONDecoder)�PlayContext)�connection_loader)�unfrackpath� makedirs_safe)�Display)� JsonRpcServerc C sn t | �� �� �}| �|�}t|�|k r.td��t| �� �� �}|t�|�� � kr^td� |���|�dd�}|S )Nz"EOF found before data was completez/Read {0} bytes, but data did not match checksums \r� )�int�readline�strip�read�len� Exceptionr �hashlibZsha1Z hexdigest�format�replace)Zbyte_stream�size�dataZ data_hash� r# �S/usr/lib/python3.9/site-packages/ansible/cli/scripts/ansible_connection_cli_stub.py�read_stream( s r% c c sF t �| t jt jB d�}t�|tj� dV t�|tj� t �|� dS )z� Uses contextmanager to create and release a file lock based on the given path. This allows us to create locks using `with file_lock()` to prevent deadlocks related to failure to unlock properly. i� N) �os�open�O_RDWR�O_CREAT�fcntl�lockfZLOCK_EXZLOCK_UN�close)� lock_pathZlock_fdr# r# r$ � file_lock9 s r. c @ sJ e Zd ZdZddd�Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dS )�ConnectionProcessz� The connection process wraps around a Connection object that manages the connection to a remote device that persists over the playbook Nc C sB || _ || _|| _|| _|| _d | _t� | _d | _d | _ || _ d S )N)�play_context�socket_path� original_path� _task_uuid�fd� exceptionr �srv�sock� connection�_ansible_playbook_pid)�selfr4 r0 r1 r2 � task_uuid�ansible_playbook_pidr# r# r$ �__init__M s zConnectionProcess.__init__c C s� t � }i }�z��z&|�dd| j f� | jjrV| jjd dvrVtj�| j| jj�| j_t j | jj| jd| j| j d�| _z| jj|d� W n> ty� } z&|�dt|�f� td ��W Y d }~n d }~0 0 | j| j_| j�| j� |�d d� tj�� �� D �� t�tjtj�| _| j�| j� | j�d� |�d � W nN t�y� } z4|�| j� � � t|�|d<