
    Vhn                         d dl mZmZmZ eZdZd dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ  e       Z G d d	e      Zy
)    )absolute_importdivisionprint_functiona;  
author:
 - Ansible Networking Team (@ansible-network)
name: persistent
short_description: Use a persistent unix socket for connection
description:
- This is a helper plugin to allow making other connections persistent.
version_added: 1.0.0
extends_documentation_fragment:
- ansible.netcommon.connection_persistent
)start_connection)to_text)
Connection)ConnectionBase)Displayc                   P     e Zd ZdZdZdZ fdZd ZddZd Z	d Z
d	 Zd
 Z xZS )r   zLocal based connectionszansible.netcommon.persistentFc                 v    t        t        | 
  ||g|i | t        |j	                  dd            | _        y )N	task_uuid )superr   __init__r   get
_task_uuid)selfplay_context	new_stdinargskwargs	__class__s        s/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ansible/netcommon/plugins/connection/persistent.pyr   zConnection.__init__&   s5    j$(yR4R6R!&**[""=>    c                     d| _         | S NT
_connectedr   s    r   _connectzConnection._connect*   s    r   c                     t         j                  d| j                  z  | j                  j                         t        | j                        }|j                  |||      }d|dfS )Nzexec_command(), socket_path=%shost)in_datasudoabler   r   )displayvvvvsocket_path_play_contextremote_addrSocketConnectionexec_command)r   cmdr$   r%   
connectionouts         r   r,   zConnection.exec_command.   se    ,t/?/??##// 	 	
 &d&6&67
%%c7X%N#rzr   c                      y N r   in_pathout_paths      r   put_filezConnection.put_file7       r   c                      y r1   r2   r3   s      r   
fetch_filezConnection.fetch_file:   r7   r   c                     d| _         y )NFr   r   s    r   closezConnection.close=   s	    r   c                 j   t         j                  d| j                  j                         t         j	                  ddd       d| j                  d      i}t        | j                  || j                        }t         j                  d	|z  | j                  j                         t        | d
|       |S )zReturns the path of the persistent connection socket.

        Attempts to ensure (within playcontext.timeout seconds) that the
        socket path exists. If the path exists (or the timeout has expired),
        returns the socket path.
        z5starting connection from persistent connection pluginr"   z0support for connection local has been deprecatedz
2027-01-01zansible.netcommon)msgdatecollection_nameansible_command_timeoutpersistent_command_timeoutzlocal domain socket path is %s_socket_path)	r&   r'   r)   r*   
deprecated
get_optionr   r   setattr)r   	variablesr(   s      r   runzConnection.run@   s     	C##// 	 	
 	B/ 	 	

 /@\0]^	&t'9'99dooV,{:##// 	 	
 	nk2r   r   )__name__
__module____qualname____doc__	transporthas_pipeliningr   r    r,   r6   r9   r;   rG   __classcell__)r   s   @r   r   r       s3    !.IN? r   r   N)
__future__r   r   r   type__metaclass__DOCUMENTATIONansible.executor.task_executorr   ansible.module_utils._textr   ansible.module_utils.connectionr   r+   ansible.plugins.connectionr	   ansible.utils.displayr
   r&   r2   r   r   <module>rX      sB    A @ 
 < . J 5 ) )7 7r   