%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/ini_manage.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l m Z d d l m Z d Z d � Z d d e d � Z d d d � Z d d d � Z d d d � Z d S( uu Manage ini files ================ :maintainer: <akilesh1597@gmail.com> :maturity: new :depends: re :platform: all i ( t absolute_importt print_functiont unicode_literals( t six( t OrderedDictu inic C@ s d t k r t St S( u2 Only load if the ini module is available u ini.set_option( t __salt__t __virtualname__t False( ( ( s: /usr/lib/python2.7/site-packages/salt/states/ini_manage.pyt __virtual__ s u =c C@ s� i | d 6i d 6t d 6d d 6} t d r9 d | d <n y�i } | r�i } xF | j � D]8 \ } } t | t t f � s[ | j i | | 6� q[ q[ Wt d | | � } i } i } xZ | j � D]L \ } } t | t t f � r� | j i | | 6� q� | j i | | 6� q� Wt d r�x� | D]� } | | k r�t j | | � t j | | � k rx| d c d j | � 7<q�| d c d j | � 7<d | d <q$| d c d j | � 7<d | d <q$Wn# t d | | | � } | j | � | r�x� t | � j | � D]s } t d r=| d c d j | � 7<d | d <qt d | d | | � | j i i | | d 6d d 6| 6� qWn xmg | j � D]- \ } } t | t t f � r�| | f ^ q�D]\ } } | r�d | n d } i | | <| r�| j | i � } x� t | j � � j | j � � D]� } | j | i � j | d � } t d r| d c d j | | � 7<d | d <q(t d | | | | � | | j i d | 6� | | j i i | d 6d d 6| 6� q(Wn t d rxx� | D]� } t j | | � t j | j | i � j | d � � k rK| d c d j | | � 7<q�| d c d j | | � 7<d | d <q�Wq�t d | i | | 6| � } | r�| | j | | � n | | s�| | =q�q�Wn# t d s�t d | | | � } n Wn7 t t f k r+} d j | � | d <t | d <| SXd | k rft | d <d j | d � | d <i | d <nL xI | j � D]; \ } } | rsd | d <| d j i | | | 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 u nameu changesu resultu No anomaly detectedu commentu testu u ini.get_iniu Unchanged key {0}. u Changed key {0}. u ini.set_optionu Removed key {0}. u ini.remove_optionu beforeu afteru in section u #-#-u Deleted key {0}{1}. u Unchanged key {0}{1}. u Changed key {0}{1}. u {0}u erroru Errors encountered. {0}u Changes take effectN( t Truet __opts__t itemst isinstancet dictR t updateR R t text_typet formatt Nonet sett differencet gett keyst IOErrort KeyErrorR ( t namet sectionst separatort strictt rett changest optionst snamet sbodyt cur_init original_top_level_optst original_sectionst keyt valt optiont options_updatedt opt_to_removet section_namet section_bodyt section_descrt originalt key_to_removet orig_valuet errt cinamet body( ( s: /usr/lib/python2.7/site-packages/salt/states/ini_manage.pyt options_present s� & 1 ( * #c C@ s i | d 6i d 6t d 6d d 6} t d r�t | d <d | d <x}| pL i D]o} | rc d | n d } y t d | | | � } WnG t k r� } d j | � | d <t | d <| St k r� | } n Xt | | t t f � r[x� | | D]c } | j | � } | s.| d c d j | | � 7<q� n | d c d j | | � 7<d | d <q� WqM | } t d | d | | � s�| d c d j | � 7<qM n | d c d j | � 7<d | d <qM W| d d k r�d | d <n | S| p�i } xt j | � D]� \ } } x� | D]� } y t d | | | | � } Wn1 t k rf} d j | � | d <t | d <| SX| ssqn | | d k r�| d j i i | 6� n | d | j i | | 6� t | | t t f � s�| d j i | | 6� n d | 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 u nameu changesu resultu No anomaly detectedu commentu testu u in section u ini.get_sectionu {0}u Key {0}{1} does not exist. u Deleted key {0}{1}. u ini.get_optionu Key {0} does not exist. u Deleted key {0}. u No changes detected.u ini.remove_optionu Changes take effectN( R R R R R R t AttributeErrorR R R R R R t iteritemsR ( R R R R t sectionR) t cur_sectionR/ R$ t cur_valueR&