%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/http.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZdgZej	e
�Zddddd�Z
dd�ZdS(	ul
HTTP monitoring states

Perform an HTTP query and statefully return the result

.. versionadded:: 2015.5.0
i(tabsolute_importtprint_functiontunicode_literalsNuqueryustringcK@s�i|d6dd6dd6id6id6}|dkr_|dkr_t|d<|dcd7<|Sd|krxt|d<nt|d	<t|d
<tdr�t|d<n|r�td|d
||�}ntd||�}|dk	r�|dkrT||jd	d�kr.t|d<|dcdj|�7<q�t|d<|dcdj|�7<q�|dkr�tj||jd	d��r�t|d<|dcdj|�7<q�t|d<|dcdj|�7<q�n|dk	rP|jd
d�|kr*|dcdj|�7<|ddkrMt|d<qMqP|dcdj|�7<t|d<ntdtkr�d|d<|dcd7<d|kr�|dcdj|d�7<n|dcd7<n||d<|S(u
    Perform an HTTP query and statefully return the result

    Passes through all the parameters described in the
    :py:func:`utils.http.query function <salt.utils.http.query>`:

    name
        The name of the query.

    match
        Specifies a pattern to look for in the return text. By default, this will
        perform a string comparison of looking for the value of match in the return
        text.

    match_type
        Specifies the type of pattern matching to use. Default is ``string``, but
        can also be set to ``pcre`` to use regular expression matching if a more
        complex pattern matching is required.

        .. note::

            Despite the name of ``match_type`` for this argument, this setting
            actually uses Python's ``re.search()`` function rather than Python's
            ``re.match()`` function.

    status
        The status code for a URL for which to be checked. Can be used instead of
        or in addition to the ``match`` setting.

    If both ``match`` and ``status`` options are set, both settings will be checked.
    However, note that if only one option is ``True`` and the other is ``False``,
    then ``False`` will be returned. If this case is reached, the comments in the
    return data will contain troubleshooting information.

    For more information about the ``http.query`` state, refer to the
    :ref:`HTTP Tutorial <tutorial-http>`.

    .. code-block:: yaml

        query_example:
          http.query:
            - name: 'http://example.com/'
            - status: 200

    unameuresultuucommentuchangesudatauA Either match text (match) or a status code (status) is required.udecodeutextustatusutestuhttp.wait_for_successful_querytwait_foru
http.queryustringu Match text "{0}" was found.u  Match text "{0}" was not found.upcreu Match pattern "{0}" was found.u# Match pattern "{0}" was not found.u#Status {0} was found, as specified.u'Status {0} was not found, as specified.u (TEST MODEutest_urlu, TEST URL WAS: {0}u)N(	tNonetFalsetTruet__opts__t__salt__tgettformattretsearch(tnametmatcht
match_typetstatusRtkwargstrettdata((s4/usr/lib/python2.7/site-packages/salt/states/http.pytquerys^/














 
i,cK@s�tj�}x�tr�d}d}y!t||�}|drA|SWntk
r]}|}nXtj�||kr�|r�|r�|�n|Sd|krtjd|d�tj|d�qqWdS(u	
    Like query but, repeat and wait until match/match_type or status is fulfilled. State returns result from last
    query state in case of success or if no successful query was made within wait_for timeout.

    name
        The name of the query.

    wait_for
        Total time to wait for requests that succeed.

    request_interval
        Optional interval to delay requests by N seconds to reduce the number of requests sent.

    .. note::

        All other arguments are passed to the http.query state.
    uresulturequest_intervaludelaying query for %s seconds.N(ttimeRRRt	Exceptiontlogtdebugtsleep(R
RRt	starttimetcaught_exceptionRtexc((s4/usr/lib/python2.7/site-packages/salt/states/http.pytwait_for_successful_query�s"	


	(t__doc__t
__future__RRRtloggingRRt__monitor__t	getLoggert__name__RRRR(((s4/usr/lib/python2.7/site-packages/salt/states/http.pyt<module>s	l

Zerion Mini Shell 1.0