%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/statuspage.pyc

�
���^c@@sMdZddlmZmZmZddlZddlZddlmZdZ	ej
e�ZddgZ
dd	gZd
Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdddddd�Zddddddd�Zddddddd�Zddddeed�Z dS(u
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
i(tabsolute_importtunicode_literalstprint_functionN(tsixu
statuspageu
created_atu
updated_atuidunameicC@stS(u2
    Return the execution module virtualname.
    (t__virtualname__(((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt__virtual__7scC@s i|d6td6dd6id6S(u&
    Default dictionary returned.
    unameuresultuucommentuchanges(tFalse(tname((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt_default_ret>s
cC@sigd6gd6gd6S(uA
    Default dictionary retuned by the _compute_diff helper.
    uadduupdateuremove((((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt_compute_diff_retJscC@std�tj|�D��S(uI
    Eliminates None entries from the features of the endpoint dict.
    cs@s-|]#\}}|dk	r||fVqdS(N(tNone(t.0t	prop_nametprop_val((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pys	<genexpr>Zs	(tdictRt	iteritems(tendpoint_props((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt_clear_dictUscC@std�tj|�D��S(u�
    Ignores some keys that might be different without any important info.
    These keys are defined under _DO_NOT_COMPARE_FIELDS.
    cs@s-|]#\}}|tkr||fVqdS(N(t_DO_NOT_COMPARE_FIELDS(RRR
((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pys	<genexpr>fs	(RRR(R((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt_ignore_keys`scC@s7g}x*|D]"}||kr
|j|�q
q
W|S(uZ
    Returns an unique list of dictionaries given a list that may contain duplicates.
    (tappend(t
list_of_dictstunique_listtele((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt_uniquels

cC@std�tj|�D��S(uB
    Both _clear_dict and _ignore_keys in a single iteration.
    cs@s9|]/\}}|tkr|dk	r||fVqdS(N(RR
(RRR
((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pys	<genexpr>|s	(RRR(R((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt
_clear_ignorewscC@s#tg|D]}t|�^q
�S(u(
    Apply _clear_ignore to a list.
    (RR(tlstR((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt_clear_ignore_list�scC@sHxA|D]9}x0tD](}|j|�|j|�kr|SqWqWdS(u,
    Find a matching element in a list.
    N(t_MATCH_KEYStget(RRt_elet	match_key((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt_find_match�s

c@s�t��fd�tj��D��}tt|j��tt�B�ttt��kr}d|kry�d|d<n|SdS(uB
    Return a dict with fields that differ between two dicts.
    c3@sK|]A\}}�j|��j|�ks9|tkr||fVqdS(N(RR(RRR
(tnew_eletprev_ele(s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pys	<genexpr>�s	uidN(RRRtlentsettkeysR(R"R!t
fields_update((R!R"s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt_update_on_fields�s4cC@s7g}g}g}t�}|s9|ji|d6�|S|sW|ji|d6�|St|�}t|�}xg|D]_}||krvt||�}	|	s�|j|�q�t|	|�}
|
r�|j|
�q�qvqvWxB|D]:}||kr�t||�}	|	s|j|�qq�q�Wi|d6|d6|d6S(ud
    Compares configured endpoints with the expected configuration and returns the differences.
    uadduremoveuupdate(R	tupdateRR RR'(texpected_endpointstconfigured_endpointst
new_endpointstupdate_endpointstremove_endpointstrettexpected_endpoints_cleartconfigured_endpoints_cleartexpected_endpoint_cleartmatching_elet
update_fieldstconfigured_endpoint_clear((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt
_compute_diff�s>			

u	incidentscK@sAt|�}|d }tdr�djd|�|d<d|d<i|d|<xPtj|�D]?\}	}
|
dks^|	jd�r�q^n|
|d||	<q^W|Std	d|d
|d|d|d
||�}|jd�s
djd|d|jd��|d<n3djd|�|d<t	|d<|jd�|d<dS(u�
    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
    i����utestu*The following {endpoint} would be created:tendpointucommenturesultuchangesu__ustatuspage.createtapi_urltpage_idtapi_keytapi_versionu"Unable to create {endpoint}: {msg}tmsgu{endpoint} created!uoutN(
Rt__opts__tformatR
RRt
startswitht__salt__RtTrue(RR6R7R8R9R:tkwargsR.tendpoint_sgtkargtwargt	sp_create((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pytcreate�s.&


	
c
K@s�t|�}|d }	|sFtjd|	�djd|	�|d<|Stdr�djd|	d|�|d<d|d	<i|d
|<xPtj|�D]?\}
}|dks�|
jd�r�q�n||d
||
<q�W|St	dd|d|d
|d|d|d||�}|j
d	�sLdjd|	d|d|j
d��|d<n9djd|	d|�|d<t|d	<|j
d�|d
<dS(u�
    Update attribute(s) of a specific endpoint.

    id
        The unique ID of the enpoint 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
    i����u
Invalid %s IDu$Please specify a valid {endpoint} IDR6ucommentutestu"{endpoint} #{id} would be updated:tiduresultuchangesu__ustatuspage.updateR7R8R9R:u(Unable to update {endpoint} #{id}: {msg}R;u{endpoint} #{id} updated!uoutN(RtlogterrorR=R<R
RRR>R?RR@(
RR6RGR7R8R9R:RAR.RBRCRDt	sp_update((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyR(!s:&


	
c

C@st|�}|d }|sFtjd|�djd|�|d<|Stdrydjd|d|�|d<d|d	<ntd
d|d|d|d|d
|d|�}	|	jd	�s�djd|d|d|	jd��|d<n&djd|d|�|d<t|d	<dS(un
    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
    i����u
Invalid %s IDu$Please specify a valid {endpoint} IDR6ucommentutestu"{endpoint} #{id} would be removed!RGuresultustatuspage.deleteR7R8R9R:u(Unable to delete {endpoint} #{id}: {msg}R;u{endpoint} #{id} deleted!N(	RRHRIR=R<R
R?RR@(
RR6RGR7R8R9R:R.RBt	sp_delete((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pytdeletegs*"


	cC@smi}t|�}	|r?|r?|	jitd6dd6�|	St}
x�tj|�D]�\}}|rpt}
ntdd|d|d|d|d	|�}
|
jd�s�|	ji|
jd�d6�|	S|
jd
�}t||�||<qUW|
r|r|	jitd6dd6�|	St}xStj|�D]B\}}|jd�sl|jd�sl|jd
�r3t}q3q3W|s�|	jitd6dd6id6�|	S|	ji|d6�t	jd�r�|	jidd6dd6�|	Sxdtj|�D]S\}}|d }x�|jd�D]�}tjd||�tdd|d|d|d|d	||�}|jd�s�|	ji|jd�d6�|	S|rt
jd|�qqWx�|jd�D]�}d|kr�q�n|jd�}tjd|||�tdd|d|d|d|d|d	||�}|jd�sc|	ji|jd�d6�|	S|r�t
jd|�q�q�Wx�|jd
�D]�}d|kr�q�n|jd�}tjd||�tdd|d|d|d|d|d	|�}|jd�s,|	ji|jd�d6�|	S|r�t
jd|�q�q�Wq�W|	jitd6dd6�|	S(u�
    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
    uresultuUCannot remove everything. To allow this, please set the option `allow_empty` as True.ucommentustatuspage.retrieveR6R7R8R9R:uoutuadduupdateuremoveuNo changes required.uchangesutestu0Testing mode. Would apply the following changes:i����uDefining new %s %sustatuspage.createiuiduUpdating %s #%s: %sustatuspage.updateRGuRemoving %s #%sustatuspage.deleteuStatusPage updated.N(RR(RR@RRR?RR5R<R
RHtdebugttimetsleeptpop(RtconfigR7R8R9R:tpacetallow_emptyt
complete_diffR.tis_emptyt
endpoint_nametendpoint_expected_configtendpoint_existing_config_rettendpoint_existing_configtany_changest
endpoint_diffRBtnew_endpointtaddingtupdate_endpointtendpoint_idtupdatingtremove_endpointtremoving((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pytmanaged�s�7				
	-
			
										(!t__doc__t
__future__RRRRNtloggingtsalt.extRRt	getLoggert__file__RHRRt_PACERRR	RRRRRR R'R5R
RFR(RLRRc(((s:/usr/lib/python2.7/site-packages/salt/states/statuspage.pyt<module>sZ										
	
		:<A6

Zerion Mini Shell 1.0