Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/junos/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/junos/junos_scp.pyo

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
mZdd
lmZy:ddlmZddlmZddlmZeZWnek
r�eZnXd�Zd�Zd�Zedkr
e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatustnetworktsupported_bys
---
module: junos_scp
version_added: "2.5"
author: "Christian Giese (@GIC-de)"
short_description: Transfer files from or to remote devices running Junos
description:
  - This module transfers files via SCP from or to remote devices
    running Junos.
extends_documentation_fragment: junos
options:
  src:
    description:
      - The C(src) argument takes a single path, or a list of paths to be
        transferred. The argument C(recursive) must be C(true) to transfer
        directories.
    required: true
  dest:
    description:
      - The C(dest) argument specifies the path in which to receive the files.
    default: '.'
  recursive:
    description:
      - The C(recursive) argument enables recursive transfer of files and
        directories.
    type: bool
    default: 'no'
  remote_src:
    description:
      - The C(remote_src) argument enables the download of files (I(scp get)) from
        the remote device. The default behavior is to upload files (I(scp put))
        to the remote device.
    type: bool
    default: 'no'
requirements:
  - junos-eznc
  - ncclient (>=v0.5.2)
notes:
  - This module requires the netconf system service be enabled on
    the remote device being managed.
  - Tested against vMX JUNOS version 17.3R1.10.
  - Works with C(local) connections only.
s�
# the required set of connection arguments have been purposely left off
# the examples for brevity
- name: upload local file to home directory on remote device
  junos_scp:
    src: test.tgz

- name: upload local file to tmp directory on remote device
  junos_scp:
    src: test.tgz
    dest: /tmp/

- name: download file from remote device
  junos_scp:
    src: test.tgz
    remote_src: true
sE
changed:
  description: always true
  returned: always
  type: bool
(t
AnsibleModule(tjunos_argument_spect	get_param(t	to_native(tDevice(tSCP(tConnectErrorcC`s�t|d�}it|d�p$dd6t|d�d6}t|d�r`t|d�|d<nt|d�r�t|d�|d	<nt|d
<y5t||�}|j�t|d�p�d|_Wn0tk
r�}|jd
|t|�f�nX|S(Nthosttporti>tusernametusertpasswordtpasswdtssh_keyfiletssh_private_key_filetgather_factsttimeouti
sunable to connect to %s: %s(R
tFalseRtopenRRt	fail_jsonR(tmoduleRtkwargstdevicetexc((sK/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_scp.pytconnectas 

!cC`s�|jd}|jd}t|��m}xc|jdD]T}|jdrl|j|j�d|d|�q7|j|j�d|d|�q7WWdQXdS(Ntdestt	recursivetsrct
remote_srct
local_pathtremote_path(tparamsR
tgettstriptput(RRR!R"tscpR#((sK/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_scp.pyttransfer_files{s


"cC`sxtdtdddt�dtdddtdd�d	tdd
dt�dtdd
dt�dtdd
dd
g��}|jt�td|dt�}|jddkr�i|jd<nts�|j	dd�ntdt�}|j
sgzMyt|�}t||�Wn)t
k
r<}|j	dt|��nXWdy|j�Wnt
k
rbnXXn|j|�dS(s3 Main entry point for Ansible module execution
    R#ttypetlisttrequiredR!tpathtdefaultt.R"tboolR$t	transporttnetconftchoicest
argument_spectsupports_check_modetprovidertmsgsnjunos-eznc is required but does not appear to be installed. It can be installed using `pip install junos-eznc`tchangedN(tdicttTrueRtupdateR	RR'tNonetHAS_PYEZRt
check_modeR R,t	ExceptionRtcloset	exit_json(R7RtresultRtex((sK/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_scp.pytmain�s8
		
		
t__main__N(t
__future__RRRR-t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt(ansible.module_utils.network.junos.junosR	R
tansible.module_utils._textRt
jnpr.junosRtjnpr.junos.utils.scpR
tjnpr.junos.exceptionRR=R@tImportErrorRR R,RGt__name__(((sK/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_scp.pyt<module>s,


-


			.

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]