Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/files/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/files/archive.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlmZdd
lmZmZddlmZmZddlmZeZer^yddl Z e!Z"Wn e#k
rZe�Ze$Z"nXn=yddl%m Z e!Z"Wn e#k
r�e�Ze$Z"nXd�Z&e'dkr�e&�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: archive
version_added: '2.3'
short_description: Creates a compressed archive of one or more files or trees
extends_documentation_fragment: files
description:
    - Packs an archive.
    - It is the opposite of M(unarchive).
    - By default, it assumes the compression source exists on the target.
    - It will not copy the source file from the local system to the target before archiving.
    - Source files can be deleted after archival by specifying I(remove=True).
options:
  path:
    description:
      - Remote absolute path, glob, or list of paths or globs for the file or files to compress or archive.
    type: list
    required: true
  format:
    description:
      - The type of compression to use.
      - Support for xz was added in Ansible 2.5.
    type: str
    choices: [ bz2, gz, tar, xz, zip ]
    default: gz
  dest:
    description:
      - The file name of the destination archive.
      - This is required when C(path) refers to multiple files by either specifying a glob, a directory or multiple paths in a list.
    type: path
  exclude_path:
    description:
      - Remote absolute path, glob, or list of paths or globs for the file or files to exclude from the archive.
    type: list
    version_added: '2.4'
  force_archive:
    version_added: '2.8'
    description:
      - Allow you to force the module to treat this as an archive even if only a single file is specified.
      - By default behaviour is maintained. i.e A when a single file is specified it is compressed only (not archived).
    type: bool
    default: false
  remove:
    description:
      - Remove any added source files and trees after adding to archive.
    type: bool
    default: no
notes:
    - Requires tarfile, zipfile, gzip and bzip2 packages on target host.
    - Requires lzma or backports.lzma if using xz format.
    - Can produce I(gzip), I(bzip2), I(lzma) and I(zip) compressed files or archives.
seealso:
- module: unarchive
author:
- Ben Doherty (@bendoh)
s
- name: Compress directory /path/to/foo/ into /path/to/foo.tgz
  archive:
    path: /path/to/foo
    dest: /path/to/foo.tgz

- name: Compress regular file /path/to/foo into /path/to/foo.gz and remove it
  archive:
    path: /path/to/foo
    remove: yes

- name: Create a zip archive of /path/to/foo
  archive:
    path: /path/to/foo
    format: zip

- name: Create a bz2 archive of multiple files, rooted at /path
  archive:
    path:
    - /path/to/foo
    - /path/wong/foo
    dest: /path/file.tar.bz2
    format: bz2

- name: Create a bz2 archive of a globbed path, while excluding specific dirnames
  archive:
    path:
    - /path/to/foo/*
    dest: /path/file.tar.bz2
    exclude_path:
    - /path/to/foo/bar
    - /path/to/foo/baz
    format: bz2

- name: Create a bz2 archive of a globbed path, while excluding a glob of dirnames
  archive:
    path:
    - /path/to/foo/*
    dest: /path/file.tar.bz2
    exclude_path:
    - /path/to/foo/ba*
    format: bz2

- name: Use gzip to compress a single archive (i.e don't archive it first with tar)
  archive:
    path: /path/to/foo/single.file
    dest: /path/file.gz
    format: gz

- name: Create a tar.gz archive of a single file.
  archive:
    path: /path/to/foo/single.file
    dest: /path/file.tar.gz
    format: gz
    force_archive: true
s�
state:
    description:
        The current state of the archived file.
        If 'absent', then no source files were found and the archive does not exist.
        If 'compress', then the file source file is in the compressed state.
        If 'archive', then the source file or paths are currently archived.
        If 'incomplete', then an archive was created, but not all source paths were found.
    type: str
    returned: always
missing:
    description: Any files that were missing from the source.
    type: list
    returned: success
archived:
    description: Any files that were compressed or added to the archive.
    type: list
    returned: success
arcroot:
    description: The archive root.
    type: str
    returned: always
expanded_paths:
    description: The list of matching paths from paths argument.
    type: list
    returned: always
expanded_exclude_paths:
    description: The list of matching exclude paths from the exclude_path argument.
    type: list
    returned: always
N(t
format_exc(t
AnsibleModuletmissing_required_lib(tto_bytest	to_native(tPY3(tlzmac2"C`s�tdtdtdddt�dtdddd	d
dd	dd
dg�dtdd�dtdd�dtdddt�dtdddt��dtdt�}|j}|j}|d}|d}|s�dnt|dd�}|d}|d}g}g}	|d}
t|
dd�}|d}t}
t}d}t}g}tr�|
d
kr�|j	dt
ddd�dt�|j	dd�nx||D]t}tj
jtj
jt|dd���}d|ks�d |kr|jtj|��t}
q�|j|�q�W|r�xy|D]n}tj
jtj
jt|dd���}d|ksid |kr�|	jtj|��q!|	j|�q!Wn|s�|j	dd!j|�d"td!j|�dd�dd#�S|s
|
ptj
j|d$�pt|�d%k}nt}|r8|r8d&|d$|f}n|rm|rm|j	d|dd!j|�dd'�nttjdd�}g}g}d(}xM|D]E}|d(kr�tj
j|�|}nqx2tt|��D]}||||kr�Pq�q�W|t|�kr-tj
j|d$|d%!�}n||7}|r�tj
j|�r�|}|jd)�sq|d)7}n|j|�r�|j	dd!j|�dd*�q�ntj
j|�r�||	kr�|j|�q�|j|�q�Wt|�t|�krJ|rJtj
j|�rJtjd+tj
j |�tj!�rAd,}q�d-}nT	|r/|sttj
j|�r�d,}q�n|r�d.}nd}d$}g}tj
j|�r�tj
j"|�}n|d,kr9
|r�t}q9
yu|
dkrt#j$t|ddd/d0�d1t#j%t�}n�|
d	ks.|
dkrYt&j't|ddd/d0�d2|
�}nf|
d
kr�t(j)�}t&j'd3|d4d1�}n3|
dkr�t&j't|ddd/d0�d1�}ntj*d5tj+|��} xm|D]e}tj
j|�r�xJtj,|d6t�D]�\}!}"}#|!j|�s;|!|7}!nx�|"D]�}$|!|$}%t|%ddd/d0�}&t| j-d(|%�dd�}'y9|
dkr�|j.|&|'�n|j/|&|'d7t�WqBt0k
r�}(|jd8|&t|(�f�qBXqBWx�|#D]�})|!|)}%t|%ddd/d0�}&t| j-d(|%�dd�}'yF|
dkrg|j.|&|'�n|j/|&|'d7t�|j|%�Wq�t0k
r�}(|jd9t|�t|(�f�q�Xq�WqWq�t|ddd/d0�}t| j-d(|�dd�}*|
dkr$	|j.||*�n|j/||*d7t�|j|�q�WWn[t0k
r�	}(|
dkrp	dnd:|
}+|j	dd;|+|t|(�fdt1��nX|r�	|j2�d,}n|
d
kr

t3j'|d<��},|,j.|j4��WdQX|j2�n|r9
|j	dd=|d>j|�f�q9
n|dKkr�
|r�
xs|D]k}y<tj
j|�r}
t5j6|�n|s�
tj7|�nWqR
t8k
r�
}(|jt|��qR
XqR
W|r�
|j	d|dd?d@|�q�
n|rtj
j"|�|krt}n|r�|d.kr�d,}q�no|d$}tj
j|�pZtj
j|�sfd}n�tj
j|�r�tj
j|�r�d-}n�|jr�tj
j|�s2t}q2nwd$}d}-}.}tj
j|�r�tj
j"|�}ny�|
dkr}t#j$t|ddd/d0�d1t#j%t�}|j.t|ddd/d0�t|t|�dd��|j2�d,}n|
dkr�t&j't|ddd/d0�d1�}|j/t|ddd/d0��|j2�n�t'|dA�}-t|ddd/d0�}/|
d	kr!
t9j'|/d<�}.nN|
dkrB
t:j;|/d<�}.n-|
d
krc
t3j<|/d<�}.nt8dB��t5j=|-|.�|j|�WnHt8k
r�
}(|j	dt|�d|ddCt|(�dt1��nX|r�
|j2�n|-r�
|-j2�n|.r|.j2�ntj
j"|�|kr2t}nd-}|r�|r�ytj7|�Wq�t8k
r�}(|j	dt|�ddDt|(�dt1��q�Xn||d<|j>|�}0|s�|j?|0|�}n|j@dEg|D]}1t|1dd�^q�d|dF|dG|dHt|dd�dIg|D]}1t|1dd�^q+d"g|D]}1t|1dd�^qPdJg|	D]}1t|1dd�^qu�dS(LNt
argument_spectpathttypetlisttrequiredtformattstrtdefaulttgztchoicestbz2ttartxztziptdesttexclude_patht
force_archivetbooltremovetadd_file_common_argstsupports_check_modeterrorstsurrogate_or_stricttabsenttmsgslzma or backports.lzmatreasonswhen using xz formatt	exceptions8lzma or backports.lzma is required when using xz format.t*t?s, texpanded_pathss!Error, no source paths were foundiis%s.%ssAError, must specify "dest" when archiving multiple files or treestt/sLError, created archive can not be contained in source paths when remove=Trues:(\.tar|\.tar\.gz|\.tgz|\.tbz2|\.tar\.bz2|\.tar\.xz|\.zip)$tarchivetcompresst
incompletetencodingtasciitwsw|tfileobjtmodes^%sttopdownt	recursives%s: %ss
Adding %s: %sstar.s'Error when writing %s archive at %s: %stwbs%Errors when writing archive at %s: %ss; s"Error deleting some source files: tfilestrbsInvalid formats&Unable to write to compressed file: %ss Unable to remove source file: %starchivedtchangedtstatetarcroottmissingtexpanded_exclude_paths(sarchiveR1(AR	tdicttTruetFalsetparamst
check_modetNoneRtHAS_LZMAt	fail_jsonR
tLZMA_IMP_ERRtosRt
expandusert
expandvarstextendtglobtappendtjoinRtisdirtlentseptdirnametrangetendswitht
startswithtlexiststexiststretsearchtbasenamet
IGNORECASEtgetsizetzipfiletZipFiletZIP_DEFLATEDttarfiletopentiotBytesIOtcompiletescapetwalktsubtwritetaddt	ExceptionRtcloseRtgetvaluetshutiltrmtreeR!tOSErrortgzipRtBZ2FiletLZMAFiletcopyfileobjtload_file_common_argumentstset_fs_attributes_if_differentt	exit_json(2tmoduleRERFtpathsRtb_destt
exclude_pathsR!tb_expanded_pathstb_expanded_exclude_pathstfmttb_fmtRtglobbyR=R>R/tb_successesRtb_pathRtb_exclude_pathtb_septb_archive_pathst	b_missingt	b_arcroottit
b_path_dirtsizeR$tarcfilet	arcfileIOtb_match_roott	b_dirpatht
b_dirnamestb_filenamest	b_dirnamet
b_fullpatht
n_fullpatht	n_arcnametet
b_filenametarcnametexpanded_fmttftf_intf_outtn_destt	file_argstp((sA/usr/lib/python2.7/site-packages/ansible/modules/files/archive.pytmain�s�*			






			
			1
(
 

	
0$				+'
%


%

2	
	
)
"	
$	%			
	$
	


	
	!
	%%%t__main__((t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRtfilecmpRORsReRKR[RpRcR`t	tracebackRtansible.module_utils.basicR	R
tansible.module_utils._textRRtansible.module_utils.sixR
RGRJRRCRHtImportErrorRDt	backportsR�t__name__(((sA/usr/lib/python2.7/site-packages/ansible/modules/files/archive.pyt<module>	sN


99 

	


	
	��

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