
    Vh                        d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ	 d dl
mZmZmZmZ d dlmZmZ d dlmZ d dlmZ d dlmZ  G d	 d
e      Zy)    )annotationsN)	constants)AnsibleErrorAnsibleAction_AnsibleActionDoneAnsibleActionFail)	to_nativeto_text)boolean)
ActionBase)
checksum_sc                  ,     e Zd ZdZddZd fd	Z xZS )ActionModuleTc                t   t        j                  t        j                        \  }}t	        j
                  |d      }d}	d}
d t        t	        j                  |            D        D ]1  }|r|j                  |      s|d|}t        j                  j                  |      r0|r/t        j                  j                  |      j                  d      rot        | j                  j                  ||      d      5 }|j!                         }d	d	d	       |
r|j#                  d
       |	rD|rBt%        j&                  |      d   }|j#                  |       |d   d
k7  r|j#                  d
       |j#                         d}	|j)                  d
      rd}
0d}
4 |j+                          |S # 1 sw Y   xY w)z/ assemble a file from a directory of fragments )dirwbFc              3  6   K   | ]  }t        |d         yw)surrogate_or_strict)errorsN)r
   ).0ps     O/home/dcms/DCMS/lib/python3.12/site-packages/ansible/plugins/action/assemble.py	<genexpr>z8ActionModule._assemble_from_fragments.<locals>.<genexpr>/   s     aq'!$9::as   /.)decryptrbN   
r   T)tempfilemkstempCDEFAULT_LOCAL_TMPosfdopensortedlistdirsearchpathisfilebasename
startswithopen_loaderget_real_filereadwritecodecsescape_decodeendswithclose)selfsrc_path	delimitercompiled_regexpignore_hiddenr   tmpfd	temp_pathtmp
delimit_meadd_newlineffragmentfragment_fhfragment_contents                  r   _assemble_from_fragmentsz%ActionModule._assemble_from_fragments'   s    $++0C0CDyiit$
aF2::V^K_D`a 	#A'='=a'@#+Q/H77>>(+"''BRBRS[B\BgBghkBldll0070KTR 6Va#.#3#3#5 6 		%   & 4 4Y ? BIIIi( !}-		%(II&'J((/#"=	#@ 			56 6s   =F..F7	c                   d| _         t        t        |   ||      }~|
t	               }| j
                  j                  j                  dd       }| j
                  j                  j                  dd       }| j
                  j                  j                  dd       }| j
                  j                  j                  dd      }| j
                  j                  j                  dd       }| j
                  j                  j                  dd      }	| j
                  j                  j                  d	d      }
| j
                  j                  j                  d
d      }	 ||t        d      t        |d      r,|j                  | j                  d|             t               	 | j                  d|      }t"        j$                  j'                  |      st        d|z        d }|t)        j*                  |      }| j-                  ||||
|      }t/        |      }| j1                  |      }| j3                  |||	      }i }| j
                  j                  j5                         }dD ]
  }||v s||=  ||d<   ||d   k7  r| j
                  j6                  r| j9                  |||      }| j:                  j<                  j?                  | j:                  j<                  j@                  d      }| jC                  ||      }| jE                  | j:                  j<                  j@                  |f       |j                  t	        |             | j                  d||      }|r||d<   |j                  |       n#|j                  | j                  d||             | jK                  | j:                  j<                  j@                         |S # t        $ r}t        t!        |            d }~ww xY w# tF        $ r%}|j                  |jH                         Y d }~d }~ww xY w# | jK                  | j:                  j<                  j@                         w xY w)NFsrcdestr8   
remote_srcyesregexpfollowr:   r   Tzsrc and dest are required)strictzansible.legacy.assemble)module_name	task_varsfileszSource (%s) is not a directory)all_varsrK   )rH   rJ   r8   r:   r   checksum)rF   zansible.legacy.copy)rM   module_argsrN   diffzansible.legacy.file)&_supports_check_modesuperr   rundict_taskargsgetpopr   r   update_execute_moduler   _find_needler   r	   r$   r)   isdirrecompilerD   r   _remote_expand_user_execute_remote_statcopyrS   _get_diff_data_connection_shell	join_pathtmpdir_transfer_file_fixup_perms2r   result_remove_tmp_path)r6   r=   rN   rl   rF   rG   r8   rH   rJ   rK   r:   r   e_rer)   path_checksum	dest_statrS   new_module_argsoptremote_pathxferedres	__class__s                          r   rV   zActionModule.runR   s   $)!|T.sI>Ijjoo!!%.zz""640JJOO''T:	ZZ__((u=
$$Xt4$$Xu5

++OUC**//%%i6>	B{dl'(CDDz%0d22?Xdm2no(**:++GS9C 77==%'(IC(OPPC!jj( 00imU\]D&t,M++D1D11$SY1ZID #jjoo224O Y -/)',- '+OF#	* 55::??..tT9ED"..55??@P@P@W@W@^@^`ef,,T;? ""D$4$4$;$;$B$BK#PQ&&t'89**7LZiu~*"&CKc"d22?Tbq  ~G2  H  I
 !!$"2"2"9"9"@"@Ak $ :+IaL99:`  	$MM!((##	$ !!$"2"2"9"9"@"@AsW   AO4 $O 6B:O4 1D-O4 	O1O,,O11O4 4	P"=PP% P""P% %1Q)NNFT)NN)__name__
__module____qualname__TRANSFERS_FILESrD   rV   __classcell__)rw   s   @r   r   r   #   s    O)VS S    r   )
__future__r   r2   r$   os.pathr`   r    ansibler   r"   ansible.errorsr   r   r   r   +ansible.module_utils.common.text.convertersr	   r
   )ansible.module_utils.parsing.convert_boolr   ansible.plugins.actionr   ansible.utils.hashingr   r    r}   r   <module>r      s<   & #  	  	  " ] ] J = - ,B: Br}   