Anons79 Mini Shell

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

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	ddl
mZddlm
Z
mZdd
lmZdefd��YZd�Zd
eddd�Zd
edeedd�Zd�Zedkr�e�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatust	communitytsupported_bys�
---
module: patch
author:
    - Jakub Jirutka (@jirutka)
    - Luis Alberto Perez Lazaro (@luisperlaz)
version_added: '1.9'
description:
    - Apply patch files using the GNU patch tool.
short_description: Apply patch files using the GNU patch tool
options:
  basedir:
    description:
      - Path of a base directory in which the patch file will be applied.
      - May be omitted when C(dest) option is specified, otherwise required.
    type: path
  dest:
    description:
      - Path of the file on the remote machine to be patched.
      - The names of the files to be patched are usually taken from the patch
        file, but if there's just one file to be patched it can specified with
        this option.
    type: path
    aliases: [ originalfile ]
  src:
    description:
      - Path of the patch file as accepted by the GNU patch tool. If
        C(remote_src) is 'no', the patch source file is looked up from the
        module's I(files) directory.
    type: path
    required: true
    aliases: [ patchfile ]
  state:
    description:
      - Whether the patch should be applied or reverted.
    type: str
    choices: [ absent, present ]
    default: present
    version_added: "2.6"
  remote_src:
    description:
      - If C(no), it will search for src at originating/master machine, if C(yes) it will
        go to the remote/target machine for the C(src).
    type: bool
    default: no
  strip:
    description:
      - Number that indicates the smallest prefix containing leading slashes
        that will be stripped from each file name found in the patch file.
      - For more information see the strip parameter of the GNU patch tool.
    type: int
    default: 0
  backup:
    version_added: "2.0"
    description:
      - Passes C(--backup --version-control=numbered) to patch, producing numbered backup copies.
    type: bool
    default: no
  binary:
    version_added: "2.0"
    description:
      - Setting to C(yes) will disable patch's heuristic for transforming CRLF
        line endings into LF.
      - Line endings of src and dest must match.
      - If set to C(no), C(patch) will replace CRLF in C(src) files on POSIX.
    type: bool
    default: no
notes:
  - This module requires GNU I(patch) utility to be installed on the remote host.
s`
- name: Apply patch to one file
  patch:
    src: /tmp/index.html.patch
    dest: /var/www/index.html

- name: Apply patch to multiple files under basedir
  patch:
    src: /tmp/customize.patch
    basedir: /var/www
    strip: 1

- name: Revert patch to one file
  patch:
    src: /tmp/index.html.patch
    dest: /var/www/index.html
    state: absent
N(t
format_exc(t
AnsibleModuletget_platform(t	to_nativet
PatchErrorcB`seZRS((t__name__t
__module__(((s?/usr/lib/python2.7/site-packages/ansible/modules/files/patch.pyRpscC`s6t�j�dkr%|jd�n
|jd�dS(Ntopenbsdtnetbsdtfreebsds--checks	--dry-run(RRR(R
tlowertappend(topts((s?/usr/lib/python2.7/site-packages/ansible/modules/files/patch.pytadd_dry_run_optiontstpresentc
C`s�ddd|d|d|g}t|�|rA|jd�n|r[|jd|�n|dkrw|jd	�n||�\}}	}	|d
kS(Ns--quiets	--forwards
--strip=%ss--directory='%s's--input='%s's--binarys'%s'Rs	--reversei(RR(
t
patch_funct
patch_filetbasedirt	dest_filetbinarytstriptstateRtrct_((s?/usr/lib/python2.7/site-packages/ansible/modules/files/patch.pytis_already_applied|s

c	C`s�ddddd|d|d|g}	|r:t|	�n|rP|	jd�n|rj|	jd	|�n|r�|	jd
�n|dkr�|	jd�n||	�\}
}}|
d
kr�|p�|}
t|
��ndS(Ns--quiets	--forwards--batchs--reject-file=-s
--strip=%ss--directory='%s's--input='%s's--binarys'%s's#--backup --version-control=numberedtabsents	--reversei(RRR(RRRRRRtdry_runtbackupRRRtoutterrtmsg((s?/usr/lib/python2.7/site-packages/ansible/modules/files/patch.pytapply_patch�s"

c`s�tdtdtdddtddg�dtdddd	g�d
tdd�dtddd
d�dtddd
t�dtddd
t�dtddd
t�dtddd
ddddg��ddd
ggdt��tdd&�j�}tj|jtj	�s(�j
dd|j�n|jrdtj|jtj�rd�j
dd|j�n|j
r�tjj|j
�r��j
dd|j
�n|j
s�tjj|j�|_
n�jd���dkr��j
dd �n��fd!�}tjj|j�|_t}t||j|j
d"|jd|jd|jd|j�s�yVt||j|j
d"|jd|jd|jd#�jd|jd|j�t}Wq�tk
r�}�j
dt|�d$t��q�Xn�jd%|�dS('Nt
argument_spectsrcttypetpathtrequiredtaliasest	patchfiletdesttoriginalfileRRtinttdefaultit
remote_srctboolR#RRtstrRtchoicesR!trequired_one_oftsupports_check_modetParamsR&s$src %s doesn't exist or not readables%dest %s doesn't exist or not writablesbasedir %s doesn't existtpatchspatch command not foundc`s �jd�dj|�f�S(Ns%s %st (trun_commandtjoin(R(tmodulet	patch_bin(s?/usr/lib/python2.7/site-packages/ansible/modules/files/patch.pyR�sRR"t	exceptiontchanged((R	tdicttTruetFalseR*tparamstostaccessR)tR_OKt	fail_jsonR/tW_OKRR+texiststdirnametget_bin_pathtNonetabspathR RRRR't
check_modeR#RRRt	exit_json(tpRRAte((R>R?s?/usr/lib/python2.7/site-packages/ansible/modules/files/patch.pytmain�sF$	"	<0
&t__main__(t
__future__RRRR*t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESRFt	tracebackRtansible.module_utils.basicR	R
tansible.module_utils._textRt	ExceptionRRRNRDR R'RTR
(((s?/usr/lib/python2.7/site-packages/ansible/modules/files/patch.pyt<module>	s"


G		7

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