
    Vh
                    p    d dl mZ dZd dl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)
    )annotationsa  
author: Stephan Lohse (!UNKNOWN) <dev-github@ploek.org>
name: iocage
short_description: Run tasks in iocage jails
description:
  - Run commands or put/fetch files to an existing iocage jail.
options:
  remote_addr:
    description:
      - Path to the jail.
    type: string
    vars:
      - name: ansible_host
      - name: ansible_iocage_host
  remote_user:
    description:
      - User to execute as inside the jail.
    type: string
    vars:
      - name: ansible_user
      - name: ansible_iocage_user
N)
Connection)	to_native)AnsibleError)Displayc                  ,     e Zd ZdZdZ fdZd Z xZS )r   z  Local iocage based connections zcommunity.general.iocagec                j   |j                   | _        t        j                  d      | _        | j                         }d| |t        j                  <   t        j                  d| j                   d|t        j                      |t        j                            t        t        | .  ||g|i | y )Niocagezioc-zJail z has been translated to )host)remote_addrioc_jailJail_search_executable
iocage_cmdget_jail_uuidmodified_jailname_keydisplayvvvsuperr   __init__)selfplay_context	new_stdinargskwargs	jail_uuid	__class__s         o/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/community/general/plugins/connection/iocage.pyr   zConnection.__init__2   s    $0011(;&&(	/3I;-?t))*DMM?":6$B\B\;]:^_223 	 	

 	j$(yR4R6R    c                   t        j                  | j                  dd| j                  gt         j                  t         j                  t         j
                        }|j                         \  }}|t        |      }|t        |      }|j                          |j                  dk7  rt        d|       |j                  d      S )Ngethost_hostuuid)stdinstdoutstderrr   ziocage returned an error: 
)
subprocessPopenr   r   PIPESTDOUTcommunicater   wait
returncoder   strip)r   pr$   r%   s       r   r   zConnection.get_jail_uuidB   s    doouot}}U#-??$.OO$.$5$57
 v&Fv&F 	
<<1!;F8DEE||D!!r   )__name__
__module____qualname____doc__	transportr   r   __classcell__)r   s   @r   r   r   -   s    **IS "r   r   )
__future__r   DOCUMENTATIONr'   =ansible_collections.community.general.plugins.connection.jailr   r   +ansible.module_utils.common.text.convertersr   ansible.errorsr   ansible.utils.displayr   r    r   r   <module>r=      s5    #.  \ A ' )
))" )"r   