a ì)g­ã@s¬ddlmZmZmZeZddlZddlZddlZddl Z ddl Z ddl m Z ddlmZmZmZmZddlmZmZddlmZddlmZddlmZGd d „d eƒZdS) é)Úabsolute_importÚdivisionÚprint_functionN)Ú constants)Ú AnsibleErrorÚ AnsibleActionÚ_AnsibleActionDoneÚAnsibleActionFail)Ú to_nativeÚto_text)Úboolean)Ú ActionBase)Ú checksum_scs,eZdZdZddd„Zd ‡fdd„ Z‡ZS) Ú ActionModuleTNFc Cs<tjtjd\}}t |d¡}d} d} dd„tt |¡ƒDƒD]ð} |rR| | ¡sRq>d|| f} tj   | ¡r>|r‚tj   | ¡  d¡r‚q>t |jj| |dd ƒ} |  ¡}Wd ƒn1s¶0Y| rÎ| d ¡| r |r t |¡d }| |¡|d d kr | d ¡| |¡d} | d ¡r*d} q>d} q>| ¡|S)z/ assemble a file from a directory of fragments )ÚdirÚwbFcss|]}t|ddVqdS)Zsurrogate_or_strict)ÚerrorsN)r )Ú.0Úp©rúC/usr/lib/python3.9/site-packages/ansible/plugins/action/assemble.pyÚ 0óz8ActionModule._assemble_from_fragments..z%s/%sÚ.)ÚdecryptÚrbNó réÿÿÿÿT)ÚtempfileZmkstempÚCZDEFAULT_LOCAL_TMPÚosÚfdopenÚsortedÚlistdirÚsearchÚpathÚisfileÚbasenameÚ startswithÚopenZ_loaderZ get_real_fileÚreadÚwriteÚcodecsÚ escape_decodeÚendswithÚclose)ÚselfZsrc_pathÚ delimiterZcompiled_regexpÚ ignore_hiddenrZtmpfdZ temp_pathÚtmpZ delimit_meZ add_newlineÚfÚfragmentZ fragment_fhZfragment_contentrrrÚ_assemble_from_fragments(s6  "&     z%ActionModule._assemble_from_fragmentsc sÚd|_tt|ƒ ||¡}~|dur(tƒ}|jj dd¡}|jj dd¡}|jj dd¡}|jj dd¡}|jj dd¡}|jj dd¡} |jj d d¡} |jj d d ¡} zzÎ|dusÀ|durÈt d ƒ‚t |dd rð|  |j d|d¡t ƒ‚nDz| d|¡}Wn2ty2} zt t| ƒƒ‚WYd} ~ n d} ~ 00tj |¡sNt d|ƒ‚d} |durft |¡} | ||| | | ¡}t|ƒ}| |¡}|j||| d}i}|jj ¡}dD]}||vr®||=q®||d<||dkrd|jjrô| |||¡}|jj  |jjj!d¡}| "||¡}| #|jjj!|f¡|  t|d¡|j d||d}|rX||d<|  |¡n|  |j d||d¡Wn2t$y®} z|  | j%¡WYd} ~ n d} ~ 00W| &|jjj!¡n| &|jjj!¡0|S)NFÚsrcÚdestr1Ú remote_srcZyesÚregexpÚfollowr2rTzsrc and dest are required)Ústrictzansible.legacy.assemble)Ú module_nameÚ task_varsÚfileszSource (%s) is not a directory)Zall_varsr;)r9r:r1r2rZchecksum)r7zansible.legacy.copy)r=Z module_argsr>Údiffzansible.legacy.file)'Z_supports_check_modeÚsuperrÚrunÚdictZ_taskÚargsÚgetÚpopr r ÚupdateZ_execute_modulerZ _find_needlerr r r%ÚisdirÚreÚcompiler6rZ_remote_expand_userZ_execute_remote_statÚcopyZ _play_contextr@Z_get_diff_dataZ _connectionZ_shellZ join_pathZtmpdirZ_transfer_fileZ _fixup_perms2rÚresultZ_remove_tmp_path)r0r3r>rLr7r8r1r9r:r;r2rÚeÚ_rer%Z path_checksumZ dest_statr@Znew_module_argsÚoptZ remote_pathZxferedÚres©Ú __class__rrrBSsl "          $$zActionModule.run)NNFT)NN)Ú__name__Ú __module__Ú __qualname__ZTRANSFERS_FILESr6rBÚ __classcell__rrrQrr$s +r)Z __future__rrrÚtypeZ __metaclass__r,r Zos.pathrIrZansiblerrZansible.errorsrrrr Zansible.module_utils._textr r Z)ansible.module_utils.parsing.convert_boolr Zansible.plugins.actionr Zansible.utils.hashingrrrrrrÚs