%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/rsync.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z
ddlZ
ddlm
Z
mZeje�ZdZd�Zd�Zeeedddedddd	�
Zd
�Zdd�ZdS(
u�
Wrapper for rsync

.. versionadded:: 2014.1.0

This data can also be passed into :ref:`pillar <pillar-walk-through>`.
Options passed into opts will overwrite options passed into pillar.
i(tabsolute_importtprint_functiontunicode_literalsN(tCommandExecutionErrortSaltInvocationErrorursynccC@s#tjjjd�rtStdfS(u5
    Only load module if rsync binary is present
    ursyncuQThe rsync execution module cannot be loaded: the rsync binary is not in the path.(tsalttutilstpathtwhicht__virtualname__tFalse(((s6/usr/lib/python2.7/site-packages/salt/modules/rsync.pyt__virtual__sc
C@sdg}|r|jd�n|r5|jd�n|rK|jd�n|rj|jdj|��n|r�|jd|g�n|r�|jd|g�|r�t}q�n|rt|t�r�x7|D]}	|jd|	g�q�Wq|jd|g�n|r|jd	�n|S(
u 
    Generate rsync options
    u-avzu--deleteu--forceu--updateu	--rsh={0}u--password-fileu--exclude-fromu	--excludeu	--dry-run(tappendtformattextendR
t
isinstancetlist(
tdeletetforcetupdatetpasswordfiletexcludetexcludefromtdryruntrshtoptionstex_((s6/usr/lib/python2.7/site-packages/salt/modules/rsync.pyt_check&s.	
ubasec
C@s�|stdd�}n|s2tdd�}n|sKtdd�}n|sdtdd�}n|s}tdd�}n|s�tdd�}n|s�tdd�}n|s�tdd	�}n|s�tdd
�}n|	s�tdd�}	n|s|rtd��nd}|jd
�r.|}
tjd
d|
�}t}|tdd|�krot}n|r�tj	�}td|
||�}|r�|}|j
d�s�dj|�}q�q+tdj|���q.t
jjj�}td|
||�}|r|}q.tdj|���nt||||||||	�}|
rqt|
t�rq||
}ndg|||g}tjd|�zGytd|dt�SWn(ttfk
r�}t|j��nXWd|r�td|�nXdS(u
    .. versionchanged:: 2016.3.0
        Return data now contains just the output of the rsync command, instead
        of a dictionary as returned from :py:func:`cmd.run_all
        <salt.modules.cmdmod.run_all>`.

    Rsync files from src to dst

    src
        The source location where files will be rsynced from.

    dst
        The destination location where files will be rsynced to.

    delete : False
        Whether to enable the rsync `--delete` flag, which
        will delete extraneous files from dest dirs

    force : False
        Whether to enable the rsync `--force` flag, which
        will force deletion of dirs even if not empty.

    update : False
        Whether to enable the rsync `--update` flag, which
        forces rsync to skip any files which exist on the
        destination and have a modified time that is newer
        than the source file.

    passwordfile
        A file that contains a password for accessing an
        rsync daemon.  The file should contain just the
        password.

    exclude
        Whether to enable the rsync `--exclude` flag, which
        will exclude files matching a PATTERN.

    excludefrom
        Whether to enable the rsync `--excludefrom` flag, which
        will read exclude patterns from a file.

    dryrun : False
        Whether to enable the rsync `--dry-run` flag, which
        will perform a trial run with no changes made.

    rsh
        Whether to enable the rsync `--rsh` flag, to
        specify the remote shell to use.

    additional_opts
        Any additional rsync options, should be specified as a list.

   saltenv
           Specify a salt fileserver environment to be used.

    CLI Example:

    .. code-block:: bash

        salt '*' rsync.rsync /path/to/src /path/to/dest delete=True update=True passwordfile=/etc/pass.crt exclude=exclude/dir
        salt '*' rsync.rsync /path/to/src delete=True excludefrom=/xx.ini
        salt '*' rsync.rsync /path/to/src delete=True exclude='[exclude1/dir,exclude2/dir]' additional_opts='["--partial", "--bwlimit=5000"]'
    u
config.optionu	rsync.srcu	rsync.dstursync.deleteursync.forceursync.updateursync.passwordfileu
rsync.excludeursync.excludefromursync.dryrunu	rsync.rshusrc and dst cannot be emptyusalt://uucp.list_master_dirstsaltenvu
cp.get_diru/u{0}/u{0} does not existucp.get_fileursyncuRunning rsync command: %sucmd.run_alltpython_shellNufile.remove(t__salt__RtNonet
startswithtretsubR
tTruettempfiletmkdtemptendswithR
RRRtfilestmkstempRRRtlogtdebugtIOErrortOSErrortstrerror(tsrctdstRRRRRRRRtadditional_optsRttmp_srct_srct_patht
src_is_dirtdir_srctfile_srctoptiontcmdtexc((s6/usr/lib/python2.7/site-packages/salt/modules/rsync.pytrsyncEs�K	
	
			
cC@s�y tdddgdt�}Wn(ttfk
rJ}t|j��nXy|jd�dj�dSWntk
r�td��nXd	S(
uB
    .. versionchanged:: 2016.3.0
        Return data now contains just the version number as a string, instead
        of a dictionary as returned from :py:func:`cmd.run_all
        <salt.modules.cmdmod.run_all>`.

    Returns rsync version

    CLI Example:

    .. code-block:: bash

        salt '*' rsync.version
    ucmd.run_stdoutursyncu	--versionRu
iiu!Unable to determine rsync versionN(RR
R+R,RR-tsplitt
IndexError(toutR9((s6/usr/lib/python2.7/site-packages/salt/modules/rsync.pytversion�s

u/etc/rsyncd.confcC@sd}yOtjjj|d��1}x'|D]}|tjjj|�7}q+WWdQXWn�tk
r}|jtjkr�t	dj
|���q|jtjkr�t	dj
|���q|jtjkr�t	dj
|���qt	dj
|j|j
���nX|SdS(u�
    .. versionchanged:: 2016.3.0
        Return data now contains just the contents of the rsyncd.conf as a
        string, instead of a dictionary as returned from :py:func:`cmd.run_all
        <salt.modules.cmdmod.run_all>`.

    Returns the contents of the rsync config file

    conf_path : /etc/rsyncd.conf
        Path to the config file

    CLI Example:

    .. code-block:: bash

        salt '*' rsync.config
    uurNu{0} does not existu!Unable to read {0}, access deniedu'Unable to read {0}, path is a directoryuError {0}: {1}(RRR'tfopentstringutilst
to_unicodeR+terrnotENOENTRR
tEACCEStEISDIRR-(t	conf_pathtrettfp_tlineR9((s6/usr/lib/python2.7/site-packages/salt/modules/rsync.pytconfig�s"
'(t__doc__t
__future__RRRRBtloggingR!R$tsalt.utils.filesRtsalt.utils.pathtsalt.exceptionsRRt	getLoggert__name__R)R	RRR
RR:R>RJ(((s6/usr/lib/python2.7/site-packages/salt/modules/rsync.pyt<module>	s0	
	!�	

Zerion Mini Shell 1.0