Anons79 Mini Shell

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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	dd
l
Z
ddlmZddl
mZmZd
�Zdefd��YZdefd��YZdefd��YZedkr�e�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysn
---
module: crypttab
short_description: Encrypted Linux block devices
description:
  - Control Linux encrypted block devices that are set up during system boot in C(/etc/crypttab).
version_added: "1.9"
options:
  name:
    description:
      - Name of the encrypted block device as it appears in the C(/etc/crypttab) file, or
        optionally prefixed with C(/dev/mapper/), as it appears in the filesystem. I(/dev/mapper/)
        will be stripped from I(name).
    type: str
    required: yes
  state:
    description:
      - Use I(present) to add a line to C(/etc/crypttab) or update its definition
        if already present.
      - Use I(absent) to remove a line with matching I(name).
      - Use I(opts_present) to add options to those already present; options with
        different values will be updated.
      - Use I(opts_absent) to remove options from the existing set.
    type: str
    required: yes
    choices: [ absent, opts_absent, opts_present, present ]
  backing_device:
    description:
      - Path to the underlying block device or file, or the UUID of a block-device
        prefixed with I(UUID=).
    type: str
  password:
    description:
      - Encryption password, the path to a file containing the password, or
        C(-) or unset if the password should be entered at boot.
    type: path
  opts:
    description:
      - A comma-delimited list of options. See C(crypttab(5) ) for details.
    type: str
  path:
    description:
      - Path to file to use instead of C(/etc/crypttab).
      - This might be useful in a chroot environment.
    type: path
    default: /etc/crypttab
author:
- Steve (@groks)
s�
- name: Set the options explicitly a device which must already exist
  crypttab:
    name: luks-home
    state: present
    opts: discard,cipher=aes-cbc-essiv:sha256

- name: Add the 'discard' option to any existing options for all devices
  crypttab:
    name: '{{ item.device }}'
    state: opts_present
    opts: discard
  loop: '{{ ansible_mounts }}'
  when: "'/dev/mapper/luks-' in {{ item.device }}"
N(t
AnsibleModule(tto_bytest	to_nativecC`sStdtdtdddt�dtdddtddd	d
dg�dtdd�d
tdd�dtdd�dtdddd��dt�}|jd}|jd
}|jd}|jd}|jd}|jd}|jd�r|td�}n|dkrO|dkrO|dkrO|dkrO|jdd|j�nd|kr�|dk	ss|dk	r�|jdd||j�nx�d|fd|fd
|fd|ffD]Y\}}|dk	r�d|ks�d|ks�|dkr�|jdd||j�q�q�Wyt|�}	|	j	|�}
Wn?t
k
rx}|jddt|�dtj
�|j�nXd|kr�|
dkr�|dkr�|jdd|j�ntd}}
|dkr�|
dk	r�|
j�\}}
q�n�|dkrS|
dk	r)|
j|||�\}}
q�|	jtd||||��\}}
n�|d
kr�|
dk	r�|
jj|�\}}
q�|	jtd||||��\}}
n6|d	kr�|
dk	r�|
jj|�\}}
q�n|r3|jr3z,t|d�}|jt|	d d!��Wd|j�Xn|jd"|d|
|j�dS(#Nt
argument_spectnamettypetstrtrequiredtstatetchoicestabsenttopts_absenttopts_presenttpresenttbacking_devicetpasswordtpathtoptstdefaults
/etc/crypttabtsupports_check_modes/dev/mapper/tmsgs>expected one or more of 'backing_device', 'password' or 'opts's:cannot update 'backing_device' or 'password' when state=%st s	ts.invalid '%s': contains white space or is emptys*failed to open and parse crypttab file: %st	exceptions,'backing_device' required to add a new entryt?twbterrorstsurrogate_or_stricttchanged(RtdicttTruetparamst
startswithtlentNonet	fail_jsontCrypttabtmatcht	ExceptionR
t	tracebackt
format_exctFalsetremovetsettaddtLineRt
check_modetopentwriteR	tcloset	exit_json(tmoduleRRRRRRtarg_nametargtcrypttabt
existing_lineteR$treasontf((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pytmainWsx'	





0
$
		0$

**R,cB`s;eZgZd�Zd�Zd�Zd�Zd�ZRS(cC`s�||_tjj|�sktjjtjj|��sUtjtjj|��nt|d�j�nz@t|d�}x*|j�D]}|jj	t
|��q�WWd|j�XdS(Ntatr(RtostexiststdirnametmakedirsR7R9t	readlinest_linestappendR5(tselfRRBtline((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyt__init__�s	cC`s|jj|�tdfS(Ns
added line(RKRLR&(RMRN((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyR4�scc`s,x%|jD]}|j�r
|Vq
q
WdS(N(RKtvalid(RMRN((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pytlines�scC`s.x'|j�D]}|j|kr
|Sq
WdS(N(RQRR*(RMRRN((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyR-�scC`s|g}x$|jD]}|jt|��qWdj|�}t|�dkr[|d7}n|ddkrx|d7}n|S(Ns
ii����(RKRLRtjoinR)(RMRQRNR>((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyt__str__�s

(t__name__t
__module__RKROR4RQR-RS(((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyR,�s				R5cB`sVeZdddddd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cC`s�||_||_||_||_t|�|_|dk	r�|jjd�|_|j|�r�|j	|�\|_}}}q�n|j
|||�dS(Ns
(RNRRRtOptionsRR*trstript_line_validt_split_lineR3(RMRNRRRR((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRO�s				$cC`s�t}|dk	r3|j|kr3||_t}n|dk	r`|j|kr`||_t}n|dk	r�t|�}||jkr�||_t}q�n|dfS(Nsupdated line(R1R*RR&RRVR(RMRRRR$((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyR3�s					cC`s<|j�s4|jd�s4t|j��dkr8tStS(Nt#iii(iii(tstripR(R)tsplitR1R&(RMRN((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRX�s4cC`st|j�}y|d}Wntk
r3d}nXy|d}Wntk
r[d}nX|d|d||fS(Niiii(R\t
IndexErrorR*(RMRNtfieldstfield2tfield3((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRY�s



cC`s"d\|_|_|_tdfS(NRsremoved line(RNN(R*RNRRR&(RM((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyR2scC`s&|jdk	r"|jdk	r"tStS(N(RR*RR&R1(RM((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRPscC`s�|j�r�|j|jg}|jdk	s6|jrh|jdk	rX|j|j�qh|jd�n|jr�|jt|j��ndj|�S|j	S(NtnoneR(
RPRRRR*RRLRRRRN(RMR^((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRSs	
N(
RTRUR*ROR3RXRYR2RPRS(((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyR5�s					RVcB`sqeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(s6opts_string looks like: 'discard,foo=bar,baz=greeble' cC`s�tt|�j�g|_|dk	r�xn|jd�D]Z}|jd�}t|�dkrw|d|d}}n|dd}}|||<q8WndS(Nt,t=ii(tsuperRVROtitemlistR*R\R)(RMtopts_stringtopttkvtktv((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRO%s	cC`skt}xXt|�j�D]D\}}||krM|||krSt}qSnt}|||<qW|dfS(Nsupdated options(R1RVtitemsR&(RMRfR$RiRj((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyR41scC`sCt}x0t|�D]"}||kr||=t}qqW|dfS(Nsremoved options(R1RVR&(RMRfR$Ri((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyR2<s
cC`s|jS(N(Re(RM((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pytkeysDscC`sg|D]}||^qS(N((RMtkey((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pytvaluesGscC`s!g|D]}|||f^qS(N((RMRm((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRkJscC`s
t|j�S(N(titerRe(RM((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyt__iter__MscC`s<||kr|jj|�ntt|�j||�dS(N(ReRLRdRVt__setitem__(RMRmtvalue((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRqPscC`s*|jj|�tt|�j|�dS(N(ReR2RdRVt__delitem__(RMRm((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRsUscC`s2t|t�o0t|j��t|j��kS(N(t
isinstanceRVtsortedRk(RMtobj((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyt__ne__YscC`scg}xM|j�D]?\}}|dkr;|j|�q|jd||f�qWdj|�S(Ns%s=%sRb(RkR*RLRR(RMtretRiRj((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRS\s(RTRUt__doc__ROR4R2RlRnRkRpRqRsRwRS(((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyRV"s										t__main__(t
__future__RRRR
t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESRFR/tansible.module_utils.basicRtansible.module_utils._textR	R
RCtobjectR,R5R%RVRT(((sC/usr/lib/python2.7/site-packages/ansible/modules/system/crypttab.pyt<module>s 


2	Q,ND

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