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__/statuspage.cpython-310.pyc
o

;j�D�@s�dZddlZddlZdZe�e�ZddgZddgZdZ	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z					d)d d!�Z						d*d"d#�Z						d*d$d%�Zdddde	d&fd'd(�ZdS)+a
StatusPage
==========

Manage the StatusPage_ configuration.

.. _StatusPage: https://www.statuspage.io/

In the minion configuration file, the following block is required:

.. code-block:: yaml

  statuspage:
    api_key: <API_KEY>
    page_id: <PAGE_ID>

.. versionadded:: 2017.7.0
�NZ
statuspageZ
created_atZ
updated_at�id�name�cCsdtvrdSdS)z2
    Return the execution module virtualname.
    �statuspage.createT)Fz%statuspage module could not be loaded)�__salt__�rr�J/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/statuspage.py�__virtual__*sr	cCs|ddid�S)z&
    Default dictionary returned.
    F�)r�result�comment�changesr)rrrr�_default_ret3srcCsgggd�S)zA
    Default dictionary retuned by the _compute_diff helper.
    ��add�update�removerrrrr�_compute_diff_ret:srcC�dd�|��D�S)zI
    Eliminates None entries from the features of the endpoint dict.
    cSsi|]\}}|dur||�qS�Nr��.0Z	prop_nameZprop_valrrr�
<dictcomp>E�
�z_clear_dict.<locals>.<dictcomp>��items�Zendpoint_propsrrr�_clear_dictA��rcCr)z�
    Ignores some keys that might be different without any important info.
    These keys are defined under _DO_NOT_COMPARE_FIELDS.
    cSsi|]\}}|tvr||�qSr��_DO_NOT_COMPARE_FIELDSrrrrrQrz _ignore_keys.<locals>.<dictcomp>rrrrr�_ignore_keysLs�r!cCs$g}|D]}||vr|�|�q|S)zZ
    Returns an unique list of dictionaries given a list that may contain duplicates.
    )�append)Z
list_of_dictsZunique_list�elerrr�_uniqueXs
�r$cCr)zB
    Both _clear_dict and _ignore_keys in a single iteration.
    cSs&i|]\}}|tvr|dur||�qSrrrrrrrgs
�z!_clear_ignore.<locals>.<dictcomp>rrrrr�
_clear_ignorecrr%cCstdd�|D��S)z(
    Apply _clear_ignore to a list.
    cSsg|]}t|��qSr)r%)rr#rrr�
<listcomp>rsz&_clear_ignore_list.<locals>.<listcomp>)r$)�lstrrr�_clear_ignore_listnsr(cCs8|D]}tD]}|�|�|�|�kr|SqqdS)z,
    Find a matching element in a list.
    N)�_MATCH_KEYS�get)r#r'Z_eleZ	match_keyrrr�_find_matchus���r+csX��fdd����D�}tt|���tt�B�ttt��kr*d|vr(�d|d<|SdS)zB
    Return a dict with fields that differ between two dicts.
    cs2i|]\}}��|���|�ks|tvr||�qSr)r*r)r��new_ele�prev_elerrr�s
�z%_update_on_fields.<locals>.<dictcomp>rN)r�len�set�keysr))r.r-Z
fields_updaterr,r�_update_on_fieldss�$�r2cCs�g}g}g}t�}|s|�d|i�|S|s|�d|i�|St|�}t|�}|D]}||vrHt||�}	|	s<|�|�q)t|	|�}
|
rH|�|
�q)|D]}||vr]t||�}	|	s]|�|�qK|||d�S)zd
    Compares configured endpoints with the expected configuration and returns the differences.
    rrr)rrr(r+r"r2)Zexpected_endpointsZconfigured_endpointsZ
new_endpointsZupdate_endpointsZremove_endpoints�retZexpected_endpoints_clearZconfigured_endpoints_clearZexpected_endpoint_clearZmatching_eleZ
update_fieldsZconfigured_endpoint_clearrrr�
_compute_diff�sF�

��
��r4�	incidentscKs�t|�}|dd�}tdr=dj|d�|d<d|d<i|d|<|��D]\}	}
|
dus1|	�d	�r2q$|
|d||	<q$|Std
d|||||d�|��}|�d�s_dj||�d�d
�|d<dS|�d�|d<d|d<|�d�|d<dS)a�
    Insert a new entry under a specific endpoint.

    endpoint: incidents
        Insert under this specific endpoint.

    page_id
        Page ID. Can also be specified in the config file.

    api_key
        API key. Can also be specified in the config file.

    api_version: 1
        API version. Can also be specified in the config file.

    api_url
        Custom API URL in case the user has a StatusPage service running in a custom environment.

    kwargs
        Other params.

    SLS Example:

    .. code-block:: yaml

        create-my-component:
            statuspage.create:
                - endpoint: components
                - name: my component
                - group_id: 993vgplshj12
    N����testz*The following {endpoint} would be created:��endpointrrr
�__r�r9�api_url�page_id�api_key�api_versionz"Unable to create {endpoint}: {msg})r9�msgz	 created!T�outr)r�__opts__�formatr�
startswithrr*)rr9r<r=r>r?�kwargsr3�endpoint_sg�karg�wargZ	sp_createrrr�create�s:(
���

�rIc
	Kst|�}|dd�}	|st�d|	�dj|	d�|d<|StdrPdj|	|d	�|d<d|d
<i|d|<|��D]\}
}|dusD|
�d�rEq7||d||
<q7|Std
d||||||d�|��}|�d
�stdj|	||�d�d�|d<dS|	�d|�d�|d<d|d
<|�d�|d<dS)a�
    Update attribute(s) of a specific endpoint.

    id
        The unique ID of the endpoint entry.

    endpoint: incidents
        Endpoint name.

    page_id
        Page ID. Can also be specified in the config file.

    api_key
        API key. Can also be specified in the config file.

    api_version: 1
        API version. Can also be specified in the config file.

    api_url
        Custom API URL in case the user has a StatusPage service running in a custom environment.

    SLS Example:

    .. code-block:: yaml

        update-my-incident:
            statuspage.update:
                - id: dz959yz2nd4l
                - status: resolved
    Nr6�
Invalid %s ID�$Please specify a valid {endpoint} IDr8rr7z"{endpoint} #{id} would be updated:�r9rrr
r:�statuspage.update�r9rr<r=r>r?z(Unable to update {endpoint} #{id}: {msg}�r9rr@� #z	 updated!TrAr)	r�log�errorrCrBrrDrr*)
rr9rr<r=r>r?rEr3rFrGrHZ	sp_updaterrrrsH(
�
���
	�rc
Cs�t|�}|dd�}|st�d|�dj|d�|d<|Stdr-dj||d	�|d<d|d
<td||||||d�}	|	�d
�sMd
j|||	�d�d�|d<dS|�d|�d�|d<d|d
<dS)an
    Remove an entry from an endpoint.

    endpoint: incidents
        Request a specific endpoint.

    page_id
        Page ID. Can also be specified in the config file.

    api_key
        API key. Can also be specified in the config file.

    api_version: 1
        API version. Can also be specified in the config file.

    api_url
        Custom API URL in case the user has a StatusPage service running in a custom environment.

    SLS Example:

    .. code-block:: yaml

        delete-my-component:
            statuspage.delete:
                - endpoint: components
                - id: ftgks51sfs2d
    Nr6rJrKr8rr7z"{endpoint} #{id} would be removed!rLr�statuspage.deleterNz(Unable to delete {endpoint} #{id}: {msg}rOrPz	 deleted!T)rrQrRrCrBrr*)
rr9rr<r=r>r?r3rFZ	sp_deleterrr�delete`s6$
�
��
�rTFcCsi}t|�}	|s|s|	�ddd��|	Sd}
|��D]2\}}|r"d}
td|||||d�}
|
�d�s@|	�d|
�d�i�|	S|
�d	�}t||�||<q|
r[|s[|	�ddd��|	Sd}|��D]\}}|�d
�st|�d�st|�d�rvd}qa|s�|	�dd
id��|	S|	�d|i�t�d�r�|	�ddd��|	S|��D]�\}}|dd�}|�d
�D]6}t�d||�tdd|||||d�|��}|�d�s�|	�d|�d�i�|	S|r�t	�
d|�q�|�d�D]D}d|vr�q�|�d�}t�d|||�tdd||||||d�|��}|�d��s#|	�d|�d�i�|	S|�r-t	�
d|�q�|�d�D]B}d|v�r<�q3|�d�}t�d||�td||||||d�}|�d��sj|	�d|�d�i�|	S|�rtt	�
d|��q3q�|	�ddd��|	S) a�
    Manage the StatusPage configuration.

    config
        Dictionary with the expected configuration of the StatusPage.
        The main level keys of this dictionary represent the endpoint name.
        If a certain endpoint does not exist in this structure, it will be ignored / not configured.

    page_id
        Page ID. Can also be specified in the config file.

    api_key
        API key. Can also be specified in the config file.

    api_version: 1
        API version. Can also be specified in the config file.

    api_url
        Custom API URL in case the user has a StatusPage service running in a custom environment.

    pace: 1
        Max requests per second allowed by the API.

    allow_empty: False
        Allow empty config.

    SLS example:

    .. code-block:: yaml

        my-statuspage-config:
            statuspage.managed:
                - config:
                    components:
                        - name: component1
                          group_id: uy4g37rf
                        - name: component2
                          group_id: 3n4uyu4gf
                    incidents:
                        - name: incident1
                          status: resolved
                          impact: major
                          backfilled: false
                        - name: incident2
                          status: investigating
                          impact: minor
    FzUCannot remove everything. To allow this, please set the option `allow_empty` as True.)rrTzstatuspage.retriever;rrrArrrzNo changes required.)rrr
r
r7z0Testing mode. Would apply the following changes:N)rrr6zDefining new %s %srrrzUpdating %s #%s: %srMrNzRemoving %s #%srSzStatusPage updated.r)rrrrr*r4rBrQ�debug�time�sleep�pop)rZconfigr<r=r>r?ZpaceZallow_emptyZ
complete_diffr3Zis_emptyZ
endpoint_nameZendpoint_expected_configZendpoint_existing_config_retZendpoint_existing_configZany_changesZ
endpoint_diffrFZnew_endpointZaddingZupdate_endpointZendpoint_idZupdatingZremove_endpointZremovingrrr�managed�s�9��	�


���	����
����
�
��	�

���rY)r5NNNN)r5NNNNN)�__doc__�loggingrVZ__virtualname__�	getLogger�__file__rQr r)Z_PACEr	rrrr!r$r%r(r+r2r4rIrrTrYrrrr�<module>s\
	
<
�I
�P
�E�

Youez - 2016 - github.com/yon3zu
LinuXploit