%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/states/ini_manage.pyo

�
���^c@@s�dZddlmZmZmZddlmZddlmZdZ	d�Z
dded�Z
ddd	�Zddd
�Zddd�ZdS(
uu
Manage ini files
================

:maintainer: <akilesh1597@gmail.com>
:maturity: new
:depends: re
:platform: all

i(tabsolute_importtprint_functiontunicode_literals(tsix(tOrderedDictuinicC@sdtkrtStS(u2
    Only load if the ini module is available
    uini.set_option(t__salt__t__virtualname__tFalse(((s:/usr/lib/python2.7/site-packages/salt/states/ini_manage.pyt__virtual__su=cC@s�i|d6id6td6dd6}tdr9d|d<ny�i}|r�i}xF|j�D]8\}}t|ttf�s[|ji||6�q[q[Wtd||�}	i}
i}xZ|	j�D]L\}}
t|
ttf�r�|ji|
|6�q�|
ji|
|6�q�Wtdr�x�|D]�}||
kr�tj	|
|�tj	||�krx|dcd	j
|�7<q�|dcd
j
|�7<d|d<q$|dcd
j
|�7<d|d<q$Wn#td|||�}|j|�|r�x�t|
�j
|�D]s}tdr=|dcdj
|�7<d|d<qtd
|d||�|jii|
|d6dd6|6�qWnxmg|j�D]-\}}t|ttf�r�||f^q�D]\}}|r�d|nd}i||<|r�|	j|i�}x�t|j��j
|j��D]�}|j|i�j|d�}tdr|dcdj
||�7<d|d<q(td
||||�||jid|6�||jii|d6dd6|6�q(Wntdrxx�|D]�}tj	||�tj	|j|i�j|d��krK|dcdj
||�7<q�|dcdj
||�7<d|d<q�Wq�td|i||6|�}|r�||j||�n||s�||=q�q�Wn#tds�td|||�}nWn7ttfk
r+}dj
|�|d<t|d<|SXd|krft|d<dj
|d�|d<i|d<nLxI|j�D];\}}|rsd|d<|dji|||6�qsqsW|S(u
    .. code-block:: yaml

        /home/saltminion/api-paste.ini:
          ini.options_present:
            - separator: '='
            - strict: True
            - sections:
                test:
                  testkey: 'testval'
                  secondoption: 'secondvalue'
                test1:
                  testkey1: 'testval121'

    options present in file and not specified in sections
    dict will be untouched, unless `strict: True` flag is
    used

    changes dict will contain the list of changes made
    unameuchangesuresultuNo anomaly detecteducommentutestuuini.get_iniuUnchanged key {0}.
uChanged key {0}.
uini.set_optionuRemoved key {0}.
uini.remove_optionubeforeuafteru in section u#-#-uDeleted key {0}{1}.
uUnchanged key {0}{1}.
uChanged key {0}{1}.
u{0}uerroruErrors encountered. {0}uChanges take effectN(tTruet__opts__titemst
isinstancetdictRtupdateRRt	text_typetformattNonetsett
differencetgettkeystIOErrortKeyErrorR(tnametsectionst	separatortstricttrettchangestoptionstsnametsbodytcur_initoriginal_top_level_optstoriginal_sectionstkeytvaltoptiontoptions_updatedt
opt_to_removetsection_nametsection_bodyt
section_descrtoriginalt
key_to_removet
orig_valueterrtcinametbody((s:/usr/lib/python2.7/site-packages/salt/states/ini_manage.pytoptions_presents�





&



1
(



*





#c
	C@si|d6id6td6dd6}tdr�t|d<d|d<x}|pLiD]o}|rcd|nd}ytd	|||�}WnGtk
r�}d
j|�|d<t|d<|Stk
r�|}nXt||tt	f�r[x�||D]c}|j
|�}	|	s.|dcdj||�7<q�n|dcdj||�7<d|d<q�WqM|}
td
|d|
|�s�|dcdj|
�7<qMn|dcdj|
�7<d|d<qMW|ddkr�d|d<n|S|p�i}xtj
|�D]�\}}x�|D]�}ytd||||�}Wn1tk
rf}d
j|�|d<t|d<|SX|ssqn||dkr�|djii|6�n|d|ji||6�t||tt	f�s�|dji||6�nd|d<qWq�W|S(u�
    .. code-block:: yaml

        /home/saltminion/api-paste.ini:
          ini.options_absent:
            - separator: '='
            - sections:
                test:
                  - testkey
                  - secondoption
                test1:
                  - testkey1

    options present in file and not specified in sections
    dict will be untouched

    changes dict will contain the list of changes made
    unameuchangesuresultuNo anomaly detecteducommentutestuu in section uini.get_sectionu{0}uKey {0}{1} does not exist.
uDeleted key {0}{1}.
uini.get_optionuKey {0} does not exist.
uDeleted key {0}.
uNo changes detected.uini.remove_optionuChanges take effectN(R	R
RRRRtAttributeErrorRR
RRRRt	iteritemsR(
RRRRtsectionR)tcur_sectionR/R$t	cur_valueR&Rt
current_value((s:/usr/lib/python2.7/site-packages/salt/states/ini_manage.pytoptions_absent�sh










c
C@s�i|d6id6td6dd6}tdrt|d<d|d<ytd||�}Wn1tk
r�}t|d<d	j|�|d<|SXxb|p�iD]T}||kr�|dcd
j|�7<q�n|dcdj|�7<d|d<q�W|ddkr
d|d<n|Si}x(|p#gD]}|jii|6�q$Wytd
|||�}	Wn1tk
r�}t|d<d	j|�|d<|SXd|	kr�t|d<dj|	d�|d<|S|	|d<d|d<|S(u�
    .. code-block:: yaml

        /home/saltminion/api-paste.ini:
          ini.sections_present:
            - separator: '='
            - sections:
                - section_one
                - section_two

    This will only create empty sections. To also create options, use
    options_present state

    options present in file and not specified in sections will be deleted
    changes dict will contain the sections that changed
    unameuchangesuresultuNo anomaly detecteducommentutestuuini.get_iniu{0}uSection unchanged {0}.
uCreated new section {0}.
uNo changes detected.uini.set_optionuerroruErrors encountered {0}uChanges take effectN(R	R
RRRRRR(
RRRRR!R/R5tsection_to_updateR)R((s:/usr/lib/python2.7/site-packages/salt/states/ini_manage.pytsections_present�sL










cC@s�i|d6id6td6dd6}tdrt|d<d|d<ytd||�}Wn1tk
r�}t|d<d	j|�|d<|SXxb|p�gD]T}||kr�|dcd
j|�7<q�n|dcdj|�7<d|d<q�W|ddkr
d|d<n|Sx�|pgD]x}ytd
|||�}Wn1tk
rq}t|d<d	j|�|d<|SX|s~qn||d|<d|d<qW|S(uM
    .. code-block:: yaml

        /home/saltminion/api-paste.ini:
          ini.sections_absent:
            - separator: '='
            - sections:
                - test
                - test1

    options present in file and not specified in sections will be deleted
    changes dict will contain the sections that changed
    unameuchangesuresultuNo anomaly detecteducommentutestuuini.get_iniu{0}uSection {0} does not exist.
uDeleted section {0}.
uNo changes detected.uini.remove_sectionuChanges take effectN(R	R
RRRRR(RRRRR!R/R5R6((s:/usr/lib/python2.7/site-packages/salt/states/ini_manage.pytsections_absentsD







N(t__doc__t
__future__RRRtsalt.extRtsalt.utils.odictRRRRRR2R9R;R<(((s:/usr/lib/python2.7/site-packages/salt/states/ini_manage.pyt<module>s	tM;

Zerion Mini Shell 1.0