HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/rsync.cpython-310.pyc
o

�N�g��@s^dZddlZddlZddlZe�e�Zdd�Zdd�Z	dd�Z
														dd
d�ZdS)
z�
State to synchronize files and directories with rsync.

.. versionadded:: 2016.3.0

.. code-block:: yaml

    /opt/user-backups:
      rsync.synchronized:
        - source: /home
        - force: True

�NcCstjj�d�r	dSdS)z3
    Only if Rsync is available.

    :return:
    �rsyncT)FzCommand not found: rsync)�salt�utils�path�which�rr�E/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/rsync.py�__virtual__&sr	cCs0dd�dd�|�d�d�dd��d�D��S)	z7
    Get summary from the rsync successful output.
    z- z
- cSsg|]}|r|�qSrr)�.0Zelmrrr�
<listcomp>7s��z _get_summary.<locals>.<listcomp>�

���z  �
)�join�split�replace)�	rsync_outrrr�_get_summary1s
��rcCs�t�}t�}|�d�d�d�dd�D]}|�d�r'|�|�dd�d�q|�|�qtj�t|��p6d	tj�t|��p?d	d
�}|dd	koM|dd	k|d
<|S)z7
    Get changes from the rsync successful output.
    rrr�Nz	deleting � r
zN/A)�copied�deletedrr�changed)�listr�
startswith�append�os�linesepr�sorted)rrr�line�retrrr�_get_changes?s 
�r!Fc
Cs(|iddd�}tj�|�s|s|sd|d<d|�d�|d<|Stj�|�s,|r,t�|�td	r2d}	td
|||||||||	|
d�
}td	sH|	rVd|d<t|d
�|d<|S|�d�rgd|d<|d|d<|St|d
�dr�t|d
�|d<t|d
�|d<|dd=|St|d
�|d<i|d<|S)a�
    Guarantees that the source directory is always copied to the target.

    name
        Name of the target directory.

    source
        Source directory.

    prepare
        Create destination directory if it does not exists.

    delete
        Delete extraneous files from the destination dirs (True or False)

    force
        Force deletion of dirs even if not empty

    update
        Skip files that are newer on the receiver (True or False)

    passwordfile
        Read daemon-access password from the file (path)

    exclude
        Exclude files, that matches pattern.

    excludefrom
        Read exclude patterns from the file (path)

    dryrun
        Perform a trial run with no changes made. Is the same as
        doing test=True

        .. versionadded:: 2016.3.1

    additional_opts
        Pass additional options to rsync, should be included as a list.

        .. versionadded:: 2018.3.0
    T�)�name�changes�result�commentFr%zDestination directory z was not found.r&�testzrsync.rsync)�delete�force�update�passwordfile�exclude�excludefrom�dryrun�additional_optsN�stdout�retcode�stderrrr$)	rr�exists�makedirsZ__opts__Z__salt__r�getr!)
r#�sourcer(r)r*r+r,r-Zpreparer.r/r r%rrr�synchronizedWsJ7'�
�


�
�r7)	FFFNNNFFN)�__doc__�loggingrZsalt.utils.pathr�	getLogger�__name__�logr	rr!r7rrrr�<module>s$
�