403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/ini_manage.cpython-310.pyc
o

;jN�@sJdZddlmZdZdd�Z	dd	d
�Zddd�Zdd
d�Zddd�ZdS)zu
Manage ini files
================

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

�)�OrderedDictZinicCsdtvrtSdS)z2
    Only load if the ini module is available
    �ini.set_optionF)�__salt__�__virtualname__�rr�J/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/ini_manage.py�__virtual__srN�=Fc
Cs�|iddd�}tdrd|d<�zi}|�ri}|��D]\}	}
t|
ttf�s.|�|	|
i�qtd|||d�}i}i}
|��D]\}}t|ttf�rS|
�||i�q@|�||i�q@tdr�|D]@}||vr�t||�t||�kr�|dd	|�d
�7<qa|dd|�d
�7<d|d
<qa|dd|�d
�7<d|d
<qantd|||||d�}|�|�|�r-t|��	|�D].}tdr�|dd|�d
�7<d|d
<q�td|d|||d�|�|||dd�i�q�dd�|��D�}t|
��	|�D]0}td�r|dd|�d
�7<d|d
<q�td||||d�|�|t|
|�dd�i�q�dd�|��D�D]�\}}|�rAd|nd}i||<|�r�|�
|i�}t|����	|���D]D}|
�
|i��
|d�}td�r~|dd�||�7<d|d
<�q[td|||||d�||�|di�||�||dd�i��q[td�r�|D]4}t||�t|
�
|i��
|d��k�r�|dd�||�7<�q�|dd�||�7<d|d
<�q��q6td|||i|||d�}|�r�||�||�||�s�||=�q6ntd�std|||||d�}Wn t
tf�y3}z|�|d<d |d
<|WYd}~Sd}~wwd!|v�rLd |d
<d"�|d!�|d<i|d#<|S|��D]\}}|�rfd$|d<|d#�|||i��qP|S)%a�
    Set or create a key/value pair in an ``ini`` file. Options present in the
    ini file and not specified in the sections dict will be untouched, unless
    the ``strict: True`` flag is used.

    Sections that do not exist will be created.

    Args:

        name (str):
            The path to the ini file

        sections (dict):
            A dictionary of sections and key/value pairs that will be used to
            update the ini file. Other sections and key/value pairs in the ini
            file will be untouched unless ``strict: True`` is passed.

        separator (str):
            The character used to separate keys and values. Standard ini files
            use the "=" character. The default is ``=``.

        strict (bool):
            A boolean value that specifies that the ``sections`` dictionary
            contains all settings in the ini file. ``True`` will create an ini
            file with only the values specified in ``sections``. ``False`` will
            append or update values in an existing ini file and leave the rest
            untouched.

        encoding (str):
            A string value representing encoding of the target ini file. If
            ``None`` is passed, it uses the system default which is likely
            ``utf-8``. Default is ``None``

            .. versionadded:: 3006.10

        no_spaces (bool):
            A bool value that specifies that the key/value separator will be
            wrapped with spaces. This parameter was added to have the ability to
            not wrap the separator with spaces. Default is ``False``, which
            maintains backwards compatibility.

            .. warning::
                This will affect all key/value pairs in the ini file, not just
                the specific value being set.

            .. versionadded:: 3006.10

    Returns:
        dict: A dictionary containing list of changes made

    Example:

    .. code-block:: yaml

        /home/saltminion/api-paste.ini:
          ini.options_present:
            - separator: '='
            - strict: True
            - sections:
                test:
                  testkey: 'testval'
                  secondoption: 'secondvalue'
                test1:
                  testkey1: 'testval121'
    T�No anomaly detected��name�changes�result�comment�test�r�ini.get_ini��	file_name�	separator�encodingzUnchanged key �.
zChanged key Nrr)r�sectionsrr�	no_spaceszRemoved key �ini.remove_option�r�section�optionrr)�beforeZaftercSs"h|]
\}}t|ttf�r|�qSr��
isinstance�dictr��.0�sname�sbodyrrr�	<setcomp>�s��z"options_present.<locals>.<setcomp>zRemoved section �ini.remove_section�rrrrcSs&g|]\}}t|ttf�r||f�qSrrr"rrr�
<listcomp>�s��z#options_present.<locals>.<listcomp>� in section z#-#-zDeleted key {}{}.
zUnchanged key {}{}.
zChanged key {}{}.
F�errorzErrors encountered. {}r
�Changes take effect)�__opts__�itemsr r!r�updater�str�set�
difference�get�keys�format�OSError�KeyError)rrr�strictrr�retr
�optionsr$r%�cur_iniZoriginal_top_level_optsZoriginal_sections�key�valrZoptions_updatedZ
opt_to_removeZdeclared_sectionsZsection_to_remove�section_nameZsection_bodyZ
section_descr�originalZ
key_to_removeZ
orig_value�errZciname�bodyrrr�options_presentsLE���

��

������

�����
���
���
����
�
��
:��
��
��rBcCsv|iddd�}tdr�d|d<d|d<|piD]�}|rd|nd}ztd	||||d
�}Wn)tyL}z|�|d<d|d<|WYd}~Sd}~wtyV|}Ynwt||t�r�||D](}	|�|	�}
|
sx|dd
�|	|�7<qb|dd|	�|�d�7<d|d<qbq|}td|d|||d�s�|dd|�d�7<q|dd|�d�7<d|d<q|ddkr�d|d<|S|p�i}|��D]m\}}|D]f}	z
td|||	||d�}
Wn"t�y}z|�|d<d|d<|WYd}~Sd}~ww|
�sq�||dv�r|d�	|ii�|d|�	|	|
i�t||t��s3|d�	||
i�d|d<q�q�|S)a�
    Remove a key/value pair from an ini file. Key/value pairs present in the ini
    file and not specified in sections dict will be untouched.

    Args:

        name (str):
            The path to the ini file

        sections (dict):
            A dictionary of sections and key/value pairs that will be removed
            from the ini file. Other key/value pairs in the ini file will be
            untouched.

        separator (str):
            The character used to separate keys and values. Standard ini files
            use the "=" character. The default is ``=``.

        encoding (str):
            A string value representing encoding of the target ini file. If
            ``None`` is passed, it uses the system default which is likely
            ``utf-8``. Default is ``None``

            .. versionadded:: 3006.10

    Returns:
        dict: A dictionary containing list of changes made

    Example:

    .. code-block:: yaml

        /home/saltminion/api-paste.ini:
          ini.options_absent:
            - separator: '='
            - sections:
                test:
                  - testkey
                  - secondoption
                test1:
                  - testkey1
    Tr
rrrrrr*zini.get_sectionr(FNzKey {}{} does not exist.
zDeleted key rzini.get_optionrzKey � does not exist.
�No changes detected.rr
r,)
r-rr6�AttributeErrorr �listr3r5r.r/)rrrrr9rr>�cur_sectionr@r<Z	cur_valuerr4Z
current_valuerrr�options_absent
s�,�
�
��
�
�
�

�
��
�rHc
Cs�|iddd�}tdrpd|d<d|d<ztd|||d	�}Wnty;}zd
|d<|�|d<|WYd}~Sd}~ww|p?iD]#}||vrS|dd|�d
�7<q@|dd|�d
�7<d|d<q@|ddkrnd|d<|Si}|pugD]	}	|�|	ii�qvztd||||d�}
Wnty�}zd
|d<|�|d<|WYd}~Sd}~wwd|
vr�d
|d<d�|
d�|d<|S|
|d<d|d<|S)a�
    Add sections to an ini file. This will only create empty sections. To also
    create key/value pairs, use options_present state.

    Args:

        name (str):
            The path to the ini file

        sections (dict):
            A dictionary of sections and key/value pairs that will be used to
            update the ini file. Only the sections portion is used, key/value
            pairs are ignored. To also set key/value pairs, use the
            options_present state.

        separator (str):
            The character used to separate keys and values. Standard ini files
            use the "=" character. The default is ``=``.

        encoding (str):
            A string value representing encoding of the target ini file. If
            ``None`` is passed, it uses the system default which is likely
            ``utf-8``. Default is ``None``

            .. versionadded:: 3006.10

    Returns:
        dict: A dictionary containing list of changes made

    Example:

    .. code-block:: yaml

        /home/saltminion/api-paste.ini:
          ini.sections_present:
            - separator: '='
            - sections:
                - section_one
                - section_two
    Tr
rrrrrrrFNzSection unchanged rzCreated new section rDrr(r+zErrors encountered {}r
r,)r-rr6r/r5)rrrrr9r;r@rZsection_to_updater>r
rrr�sections_present�sd*�
�
��

�
��rIc	Csd|iddd�}tdrpd|d<d|d<ztd|||d	�}Wnty;}zd
|d<|�|d<|WYd}~Sd}~ww|p?gD]#}||vrS|dd|�d
�7<q@|dd|�d�7<d|d<q@|ddkrnd|d<|S|psgD];}ztd||||d�}Wnty�}zd
|d<|�|d<|WYd}~Sd}~ww|s�qt||d|<d|d<qt|S)ak
    Remove sections from the ini file. All key/value pairs in the section will
    also be removed.

    Args:

        name (str):
            The path to the ini file

        sections (dict):
            A dictionary of sections and key/value pairs that will be used to
            update the ini file. Other sections and key/value pairs in the ini
            file will be untouched unless ``strict: True`` is passed.

        separator (str):
            The character used to separate keys and values. Standard ini files
            use the "=" character. The default is ``=``.

        encoding (str):
            A string value representing encoding of the target ini file. If
            ``None`` is passed, it uses the system default which is likely
            ``utf-8``. Default is ``None``

            .. versionadded:: 3006.6

    Returns:
        dict: A dictionary containing list of changes made

    Example:

    .. code-block:: yaml

        /home/saltminion/api-paste.ini:
          ini.sections_absent:
            - separator: '='
            - sections:
                - test
                - test1
    Tr
rrrrrrrFNzSection rCzDeleted section rrDr'r(r
r,)r-rr6)	rrrrr9r;r@rrGrrr�sections_absent�sV)�
�
��

�
��
rJ)Nr	FNF)Nr	N)	�__doc__�collectionsrrrrBrHrIrJrrrr�<module>s
�
v
y[

Youez - 2016 - github.com/yon3zu
LinuXploit