HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/scp_mod.cpython-310.pyc
o

�N�g��@s�dZddlZzddlZddlZdZWneydZYnwdgZdZe�e	�Z
dd�Zd	d
�Zdd�Z
ddd�Z				ddd�ZdS)zr
SCP Module
==========

.. versionadded:: 2019.2.0

Module to copy files via `SCP <https://man.openbsd.org/scp>`_
�NTF�*�scpcCstsdStS)N)Fz4Please install SCP for this modules: pip install scp)�HAS_SCP�__virtualname__�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/scp_mod.py�__virtual__srcKs�i}i}tdtjj�d}|�d�tdtjj�d}|�d�|�	�D]\}}||vr6|dur6|||<||vrB|durB|||<q&||fS)Nzargs.get_function_argspecr�auto_add_policy)
Z	__utils__�paramiko�	SSHClient�connect�appendr�	SCPClient�__init__�pop�items)�kwargs�paramiko_kwargs�
scp_kwargsZ
paramiko_argsZscp_args�key�valrrr�_select_kwargs"s�

�rcKs^tdi|��\}}t��}|�dd�r|�t���|jdi|��tj|�	�fi|��}|S)zG
    Prepare the underlying SSH connection with the remote target.
    r	FNr)
rr
rrZset_missing_host_key_policyZ
AutoAddPolicyrrrZ
get_transport)rrrZssh�
scp_clientrrr�_prepare_connection3sr�cKs6tdi|��}||d�}|r||d<|j|fi|��S)a�
    Transfer files and directories from remote host to the localhost of the
    Minion.

    remote_path
        Path to retrieve from remote host. Since this is evaluated by scp on the
        remote host, shell wildcards and environment variables may be used.

    recursive: ``False``
        Transfer files and directories recursively.

    preserve_times: ``False``
        Preserve ``mtime`` and ``atime`` of transferred files and directories.

    hostname
        The hostname of the remote device.

    port: ``22``
        The port of the remote device.

    username
        The username required for SSH authentication on the device.

    password
        Used for password authentication. It is also used for private key
        decryption if ``passphrase`` is not given.

    passphrase
        Used for decrypting private keys.

    pkey
        An optional private key to use for authentication.

    key_filename
        The filename, or list of filenames, of optional private key(s) and/or
        certificates to try for authentication.

    timeout
        An optional timeout (in seconds) for the TCP connect.

    socket_timeout: ``10``
        The channel socket timeout in seconds.

    buff_size: ``16384``
        The size of the SCP send buffer.

    allow_agent: ``True``
        Set to ``False`` to disable connecting to the SSH agent.

    look_for_keys: ``True``
        Set to ``False`` to disable searching for discoverable private key
        files in ``~/.ssh/``

    banner_timeout
        An optional timeout (in seconds) to wait for the SSH banner to be
        presented.

    auth_timeout
        An optional timeout (in seconds) to wait for an authentication
        response.

    auto_add_policy: ``False``
        Automatically add the host to the ``known_hosts``.

    CLI Example:

    .. code-block:: bash

        salt '*' scp.get /var/tmp/file /tmp/file hostname=10.10.10.1 auto_add_policy=True
    ��	recursive�preserve_times�
local_pathNr)r�get)�remote_pathrrrrrZ
get_kwargsrrrr@s
G
r�basecKsrtdi|��}||d�}|r||d<g}t|ttf�s|g}|D]}	td|	|d�}
|�|
�q |j|fi|��S)ab
    Transfer files and directories to remote host.

    files
        A single path or a list of paths to be transferred.

    remote_path
        The path on the remote device where to store the files.

    recursive: ``True``
        Transfer files and directories recursively.

    preserve_times: ``False``
        Preserve ``mtime`` and ``atime`` of transferred files and directories.

    hostname
        The hostname of the remote device.

    port: ``22``
        The port of the remote device.

    username
        The username required for SSH authentication on the device.

    password
        Used for password authentication. It is also used for private key
        decryption if ``passphrase`` is not given.

    passphrase
        Used for decrypting private keys.

    pkey
        An optional private key to use for authentication.

    key_filename
        The filename, or list of filenames, of optional private key(s) and/or
        certificates to try for authentication.

    timeout
        An optional timeout (in seconds) for the TCP connect.

    socket_timeout: ``10``
        The channel socket timeout in seconds.

    buff_size: ``16384``
        The size of the SCP send buffer.

    allow_agent: ``True``
        Set to ``False`` to disable connecting to the SSH agent.

    look_for_keys: ``True``
        Set to ``False`` to disable searching for discoverable private key
        files in ``~/.ssh/``

    banner_timeout
        An optional timeout (in seconds) to wait for the SSH banner to be
        presented.

    auth_timeout
        An optional timeout (in seconds) to wait for an authentication
        response.

    auto_add_policy: ``False``
        Automatically add the host to the ``known_hosts``.

    CLI Example:

    .. code-block:: bash

        salt '*' scp.put /path/to/file /var/tmp/file hostname=server1 auto_add_policy=True
    rr z
cp.cache_file)�saltenvNr)r�
isinstance�list�tupleZ__salt__r
�put)�filesr rrr"rrZ
put_kwargsZcached_filesZfile_Zcached_filerrrr&�sO
r&)rFF)NFFr!)�__doc__�loggingr
rr�ImportErrorZ__proxyenabled__r�	getLogger�__name__�logrrrrr&rrrr�<module>s*	�


P�