Anons79 Mini Shell

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

�
�Udac	@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	dd
l
Z
dd
lZdd
lZddl
mZd�Zd
�Zd
d
d
deeeed�Zd�Zedkr�e�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys
---
module: ini_file
short_description: Tweak settings in INI files
extends_documentation_fragment: files
description:
     - Manage (add, remove, change) individual settings in an INI-style file without having
       to manage the file as a whole with, say, M(template) or M(assemble).
     - Adds missing sections if they don't exist.
     - Before Ansible 2.0, comments are discarded when the source file is read, and therefore will not show up in the destination file.
     - Since Ansible 2.3, this module adds missing ending newlines to files to keep in line with the POSIX standard, even when
       no other modifications need to be applied.
version_added: "0.9"
options:
  path:
    description:
      - Path to the INI-style file; this file is created if required.
      - Before Ansible 2.3 this option was only usable as I(dest).
    type: path
    required: true
    aliases: [ dest ]
  section:
    description:
      - Section name in INI file. This is added if C(state=present) automatically when
        a single value is being set.
      - If left empty or set to C(null), the I(option) will be placed before the first I(section).
      - Using C(null) is also required if the config format does not support sections.
    type: str
    required: true
  option:
    description:
      - If set (required for changing a I(value)), this is the name of the option.
      - May be omitted if adding/removing a whole I(section).
    type: str
  value:
    description:
      - The string value to be associated with an I(option).
      - May be omitted when removing an I(option).
    type: str
  backup:
    description:
      - Create a backup file including the timestamp information so you can get
        the original file back if you somehow clobbered it incorrectly.
    type: bool
    default: no
  state:
    description:
      - If set to C(absent) the option or section will be removed if present instead of created.
    type: str
    choices: [ absent, present ]
    default: present
  no_extra_spaces:
    description:
      - Do not insert spaces before and after '=' symbol.
    type: bool
    default: no
    version_added: "2.1"
  create:
    description:
      - If set to C(no), the module will fail if the file does not already exist.
      - By default it will create the file if it is missing.
    type: bool
    default: yes
    version_added: "2.2"
  allow_no_value:
    description:
      - Allow option without value and without '=' symbol.
    type: bool
    default: no
    version_added: "2.6"
notes:
   - While it is possible to add an I(option) without specifying a I(value), this makes no sense.
   - As of Ansible 2.3, the I(dest) option has been changed to I(path) as default, but I(dest) still works as well.
author:
    - Jan-Piet Mens (@jpmens)
    - Ales Nosek (@noseka1)
s�
# Before Ansible 2.3, option 'dest' was used instead of 'path'
- name: Ensure "fav=lemonade is in section "[drinks]" in specified file
  ini_file:
    path: /etc/conf
    section: drinks
    option: fav
    value: lemonade
    mode: '0600'
    backup: yes

- name: Ensure "temperature=cold is in section "[drinks]" in specified file
  ini_file:
    path: /etc/anotherconf
    section: drinks
    option: temperature
    value: cold
    backup: yes
N(t
AnsibleModulecC`sOtj|�}tjd||�pNtjd||�pNtjd||�S(Ns( |	)*%s( |	)*(=|$)s#( |	)*%s( |	)*(=|$)s;( |	)*%s( |	)*(=|$)(tretescapetmatch(toptiontline((sB/usr/lib/python2.7/site-packages/ansible/modules/files/ini_file.pyt	match_opt{scC`s#tj|�}tjd||�S(Ns( |	)*%s( |	)*(=|$)(R	R
R(RR
((sB/usr/lib/python2.7/site-packages/ansible/modules/files/ini_file.pytmatch_active_opt�stpresentc
C`s�tdddddd|dd|�}
tjj|�s�|s^|jddd	d
|�ntjj|�}tjj|�r�|jr�tj|�ng}n-t|d�}
z|
j	�}Wd|
j
�X|jr�dj|�|
d<nt
}|s|jd�n|d
dks2|d
d
dkrK|d
cd7<t}nd}|jdd|�|jd�|s�|}n|}d}d}|r�d}nd}xIt|�D];\}}|jd|�r�t}|}q�|jd�r�|r�|dkr�x�t|dd
�D]n}tjd||d�s|r\|	r\|j|d|�n|j||||f�d}t}PqqWn,|dkr�|r�|||5d}t}nPq�q�|r�|r�|dkr�t||�r�|r|	rd|}n|||f}|||k}|p*|}|r<d}n|||<|r�|d}xY|t|�kr�||}|jd�r�Pnt||�r�||=qY|d}qYWnPq�q�|dkr�t||�r�||=t}d}Pq�q�q�q�W|d=|d
3|rt|rt|dkrt|jd|�|rN|	rN|jd|�n|j|||f�t}d}n|jr�dj|�|
d<nd}|r�|jr�|r�|j|�}nyHtjd|j�\}}tj|d �}|j|�|j
�Wn-t k
r8|jd	d!d"t!j"��nXy|j#||�Wq�t k
r�|j$jd	d#||fd"t!j"��q�Xn|||
|fS($Ntbeforettaftert
before_headers%s (content)tafter_headertrcitmsgsDestination %s does not exist !trs
i����t(ad01e11446efb704fcdbdb21f2c43757423d91c5is[%s]t[tOKs%s=%s
s%s = %s
Rs^[ \t]*([#;].*)?$is%s
soption addedtabsentssection removedsoption changeds[%s]
ssection and option addedtdirtws"Unable to create temporary file %st	tracebacksRUnable to move temporary                                    file %s to %s, IOError(%tdicttostpathtexistst	fail_jsontdirnamet
check_modetmakedirstopent	readlinestcloset_difftjointFalsetappendtTruetinsertt	enumeratet
startswithtrangeR	RRtlenRtNonetbackup_localttempfiletmkstempttmpdirtfdopent
writelinestIOErrorRt
format_exctatomic_movetansible(tmoduletfilenametsectionRtvaluetstatetbackuptno_extra_spacestcreatetallow_no_valuetdifftdestpatht	ini_linestini_filetchangedtfake_section_nametwithin_sectiont
section_startRtassignment_formattindexR
titnewlinetoption_changedtbackup_filettmpfdttmpfiletf((sB/usr/lib/python2.7/site-packages/ansible/modules/files/ini_file.pytdo_ini�s�

		$	
			

	

	




		

 
$cC`stdtdtdddtddg�dtdddt�d	tdd�d
tdd�dtddd
t�dtddd
ddddg�dtddd
t�dtddd
t�dtddd
t��	dtdt�}|jd}|jd}|jd	}|jd
}|jd}|jd}|jd}|jd}|jd}	t|||||||||	|�
\}
}}}
|jr�tjj	|�r�|j
|j�}|j||
�}
ntd|
d|d|
d|�}|dk	r	||d<n|j
|�dS(Nt
argument_specR"ttypetrequiredtaliasestdestRBtstrRRCREtbooltdefaultRDRtchoicesRRFRHRGtadd_file_common_argstsupports_check_modeRMRIRRV(RR R/R-tparamsRZR&R!R"R#tload_file_common_argumentstset_fs_attributes_if_differentR5t	exit_json(R@R"RBRRCRDRERFRHRGRMRVRIRt	file_argstresults((sB/usr/lib/python2.7/site-packages/ansible/modules/files/ini_file.pytmain&sD!	








3	
t__main__(t
__future__RRRR\t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESR!R	R7Rtansible.module_utils.basicRRRR5R-R/RZRlt__name__(((sB/usr/lib/python2.7/site-packages/ansible/modules/files/ini_file.pyt<module>	s&


N			�	/

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