HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //lib/python3.9/site-packages/ansible/plugins/action/__pycache__/copy.cpython-39.pyc
a

�)g�j�@s�ddlmZmZmZeZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
ZddlmZmZddlmZddlmZmZmZddlmZddlmZdd	lmZee���� d
�Z!dd�Z"d
d�Z#ddd�Z$Gdd�de�Z%dS)�)�absolute_import�division�print_functionN)�	constants)�AnsibleError�AnsibleFileNotFound)�FILE_COMMON_ARGUMENTS)�to_bytes�	to_native�to_text)�boolean)�
ActionBase)�checksum)�state�path�_original_basename�recurse�forceZ
_diff_peek�srccCstdd�|��D��S)z)remove keys that are not relevant to filecss"|]\}}|tvr||fVqdS�N)�REAL_FILE_ARGS��.0�k�v�r�?/usr/lib/python3.9/site-packages/ansible/plugins/action/copy.py�	<genexpr>/�z+_create_remote_file_args.<locals>.<genexpr>��dict�items��module_argsrrr�_create_remote_file_args-sr$cCstdd�|��D��S)zremove action plugin only keyscss"|]\}}|dvr||fVqdS))�content�decryptNrrrrrr4rz+_create_remote_copy_args.<locals>.<genexpr>rr"rrr�_create_remote_copy_args2sr'Fcs�gggd��d	���fdd�	�d}|r0||�}n|�tjj�}|durJ|}|sZtj�|�}|�|�rlt|�}|r�||�s�|d7}n|�tjj�s�|d7}tj�|�rƈs�t�|�tj�	|�f�d<�St�
|�}t|j|j
ff�}�|||��S)
aD
    Walk a filesystem tree returning enough information to copy the files

    :arg topdir: The directory that the filesystem tree is rooted at
    :kwarg base_path: The initial directory structure to strip off of the
        files for the destination directory.  If this is None (the default),
        the base_path is set to ``top_dir``.
    :kwarg local_follow: Whether to follow symlinks on the source.  When set
        to False, no symlinks are dereferenced.  When set to True (the
        default), the code will dereference most symlinks.  However, symlinks
        can still be present if needed to break a circular link.
    :kwarg trailing_slash_detector: Function to determine if a path has
        a trailing directory separator. Only needed when dealing with paths on
        a remote machine (in which case, pass in a function that is aware of the
        directory separator conventions on the remote machine).
    :returns: dictionary of tuples.  All of the path elements in the structure are text strings.
            This separates all the files, directories, and symlinks along with
            important information about each::

                { 'files': [('/absolute/path/to/copy/from', 'relative/path/to/copy/to'), ...],
                  'directories': [('/absolute/path/to/copy/from', 'relative/path/to/copy/to'), ...],
                  'symlinks': [('/symlink/target/path', 'relative/path/to/copy/to'), ...],
                }

        The ``symlinks`` field is only populated if ``local_follow`` is set to False
        *or* a circular symlink cannot be dereferenced.

    ��files�directories�symlinks�c
s<t�|�D�]*\}}}|D]�}tj�||�}tj�|||d��}	tj�|�r�tj�|�}
�r~tj�|
�r~�d�|
|	f�q��d�t�|�|	f�q�d�||	f�q|D�]�}tj�||�}tj�|||d��}
tj�|�}t�	|�}tj�|��r"��r|j
|jf|v�r0�d�t�|�|
f�n�t�}tj�
|��tjj�}tt|�dd�D]H}t�	d�|d|���}|j
|jf|v�r��q�|�|j
|jf��q\|j
|jf|v�r҈d�t�|�|
f�n4�d�||
f�t|�d}�|||�|�|
d	�n�d�t�|�|
f�q��d�||
f�q�q
dS)
a�
        This is a closure (function utilizing variables from it's parent
        function's scope) so that we only need one copy of all the containers.
        Note that this function uses side effects (See the Variables used from
        outer scope).

        :arg topdir: The directory we are walking for files
        :arg rel_offset: Integer defining how many characters to strip off of
            the beginning of a path
        :arg parent_dirs: Directories that we're copying that this directory is in.
        :kwarg rel_base: String to prepend to the path after ``rel_offset`` is
            applied to form the relative path.

        Variables used from the outer scope
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        :r_files: Dictionary of files in the hierarchy.  See the return value
            for :func:`walk` for the structure of this dictionary.
        :local_follow: Read-only inside of :func:`_recurse`. Whether to follow symlinks
        Nr)r+r����/r*�)�rel_base)�os�walkr�join�islink�realpath�isfile�append�readlink�stat�st_dev�st_ino�set�dirname�split�sep�range�len�add�union)�topdirZ
rel_offsetZparent_dirsr0�	base_pathZsub_foldersr)�filename�filepathZ
dest_filepathZ	real_filer=�dirpathZdest_dirpathZreal_dir�	dir_statsZnew_parentsZparent_dir_list�parentZparent_stat�offset��_recurse�local_followZr_filesrrrMXsB

z_walk_dirs.<locals>._recurseFNr/r+)r,)�endswithr1rr?r=�
startswithrAr4r8�basenamer9�	frozensetr:r;)rDrErN�trailing_slash_detectorZsource_trailing_slashrKrI�parentsrrLr�
_walk_dirs7s.S



rUcsBeZdZdZdd�Zdd�Zdd�Zdd	�Zd
�fdd�	Z�Z	S)�ActionModuleTcCs�d|vr>|jjrd|d<n$|jj��|d<|jj��|dd<t|dt�r�d|dvrdd|dd<|d�di��d�dur�d|ddd<|S)NZ
invocationzCENSORED: no_log is setr#r%z'CENSORED: content is a no_log parameterZ#VALUE_SPECIFIED_IN_NO_LOG_PARAMETER)�
_play_contextZno_log�_task�args�copy�
isinstancer �get)�self�resultrrr�_ensure_invocation�s
zActionModule._ensure_invocationc
Cs�t|jj�dd�dd�}t|jj�dd�dd�}	t|jj�dd�dd�}
i}g|d	<z|jj||d
�}WnDty�}z,d|d<d|t|�f|d
<|WYd}~Sd}~00d}
|jj�dd�dkr�dt�	t
�|�j�}
|jj
�|��r�|jj
�||�}n|}|j||||	d�}|d�rt|d�rt|du�rR|�||�d|d<d|d
<|S|jj
�||�}|j||||	d�}|d�r�|	�s�dSt|�}||dk�r�|jj�r�|
�s�|d	�|�|||��|jj�r�|�||�d|d<|S|jj
�|jj
jd�}d}|
�s|�||�}n|�||�|�||�|j�|�|�rT|�|jj
j|f�|
�r^dSt|jj�}|�t||||d��|jj�d��s�||d<|
�r�|
|d<|jd||d�}n�|�||�|j�|�|
�r�dS|�r|j||dd�}|d�rd|� �v�r|d}t!|jj�}|�t||ddd��z
|d =Wnt"�yPYn0|
�r`|
|d<|jd!||d�}|�d��s�||d<|�|�|S)"Nr&TF��strictrZyes�raw�no�diff)r&�failedzcould not find src=%s, %s�msg�mode�preservez0%03o)�all_vars�followr�exists�isdir�&can not use content with a dir as destr�changed�source)r�destrrj�ansible.legacy.copy��module_namer#�	task_vars)rirjZislnkZ
lnk_source�file)rprrrr�ansible.legacy.file)#rrXrYr\Z_loaderZ
get_real_filerrr9�S_IMODEr1�st_mode�_connection�_shell�path_has_trailing_slash�	join_pathZ_execute_remote_stat�#_remove_tempfile_if_content_definedrrWrdr7Z_get_diff_dataZ
check_mode�tmpdirZ_transfer_fileZcleanup_tmp_fileZ
_fixup_perms2r'�updater �_execute_module�keysr$�KeyError)r]�source_full�
source_relr%�content_tempfilerprtrjr&rrbr^�eZlmodeZ	dest_fileZdest_statusZlocal_checksumZtmp_srcZremote_path�new_module_args�
module_returnZdest_status_nofollowrrr�
_copy_file�s�

����	

zActionModule._copy_filec
Cs�tjtjd�\}}t�|d�}t|�}zRz|�|�Wn6tyl}zt�	|�t|��WYd}~n
d}~00W|�
�n
|�
�0|S)z. Create a tempfile containing defined content )�dir�wbN)�tempfileZmkstemp�CZDEFAULT_LOCAL_TMPr1�fdopenr	�write�	Exception�remove�close)r]r%�fdr��f�errrrr�_create_content_tempfile�s
 z%ActionModule._create_content_tempfilecCs|durt�|�dSr)r1r�)r]r%r�rrrr}�sz0ActionModule._remove_tempfile_if_content_definedNc
s�|durt�}tt|��||�}~|jj�dd�}|jj�dd�}|jj�dd�}t|jj�dd�dd�}t|jj�dd	�dd�}d	|d
<|s�|dur�d|d<nN|s�d
|d<n@|r�|dur�d|d<n*|dur�|dur�|�d�r�d|d<n|d
=|�d
��r|�	|�Sd}	|du�r�z<t
|t��s,t
|t��r>|�t
�|��}	n
|�|�}	|	}WnHt�y�}
z.d	|d
<dt|
�|d<|�	|�WYd}
~
Sd}
~
00n�|�r�|�|jd|d��|�	|�S|�tjj�}z|�d|�}WnPt�y,}z6d	|d
<t|�|d<t��|d<|�	|�WYd}~Sd}~00||�tjj�k�rn|dtjjk�rb|dd�}n|tjj}gggd�}
tj�t|dd���r�t|||jjj d�}
|jj� |��s�|jj�!|d�}n|tj�"|�fg|
d<d}tdd�}d}|�#|�}t$�}|
dD]�\}}|
d�rd}nt|jj�dd�dd�}|�%||||	|||�}|du�rZ�q|�d
��r~|�|�|�	|�Stj�&|�}d}|D]}tj�'||�|�(|��q�d|v�r�|d�s�|d=d	}|�p�|�d d�}�q|
dD]�\}}||v�r�q�t)|jj�}tj�'||�|d!<d"|d#<|jj�d$d�|d%<d|d&<|d=|jd'||d(�}|�d
��r�|�|�|�	|�Sd	}|�p�|�d d�}�q�|
d)D]�\}}t)|jj�}tj�'||�|d!<||d<d*|d#<d	|d+<|
d�r�d|d<|�d%d�d,k�r|�*d%�|jd'||d(�}d	}|�d
��rF|�|�|�	|�S|�pV|�d d�}�q�|�r�t+|
d�d-k�r�|�|�d!|v�r�d|v�r�|d!|d<n|�t|||d.��|�,|jjj-�|�	|�S)/z& handler for file transfer operations Nrr%rp�
remote_srcFr`rNTrezsrc (or content) is requiredrfzdest is requiredz&src and content are mutually exclusiver.rmz%could not write content temp file: %srq)rsrtr)�	exceptionr-r(Zsurrogate_or_strict)�errors)rNrSr,)rnr*rjrdrnrZ	directoryrZdirectory_modergrrvrrr+�linkrrhr/)rprrn).r �superrV�runrXrYr\rrOr_r[�listr��json�dumpsr�r
rr�r1rr?Z_find_needlerr�	traceback�
format_excrlr	rUryrzr{r|rQZ_remote_expand_userr<r�r>r3rBr$�poprAZ_remove_tmp_pathr~)r]�tmprtr^ror%rpr�rNr�r�Ztrailing_slashr�Zsource_filesrnr�Zmodule_executedZimplicit_directoriesr�r�rj�pathsZdir_pathZ
dir_componentrZ	dest_pathr�Ztarget_path��	__class__rrr��s�






"
 �










zActionModule.run)NN)
�__name__�
__module__�__qualname__ZTRANSFERS_FILESr_r�r�r}r��
__classcell__rrr�rrV�srV)NFN)&Z
__future__rrr�typeZ
__metaclass__r�r1Zos.pathr9r�r�Zansiblerr�Zansible.errorsrrZansible.module_utils.basicrZansible.module_utils._textr	r
rZ)ansible.module_utils.parsing.convert_boolrZansible.plugins.actionr
Zansible.utils.hashingrrRr�rCrr$r'rUrVrrrr�<module>s,�