%PDF- %PDF-
| Direktori : /proc/self/root/proc/3522530/root/usr/lib/python2.7/site-packages/salt/states/ |
| Current File : //proc/self/root/proc/3522530/root/usr/lib/python2.7/site-packages/salt/states/http.pyc |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d g Z e j e
� Z d d d d d � Z
d d � Z d S( ul
HTTP monitoring states
Perform an HTTP query and statefully return the result
.. versionadded:: 2015.5.0
i ( t absolute_importt print_functiont unicode_literalsNu queryu stringc K@ s� i | d 6d d 6d d 6i d 6i d 6} | d k r_ | d k r_ t | d <| d c d 7<| Sd | k rx t | d <n t | d <t | d
<t d r� t | d <n | r� t d | d
| | �} n t d | | � } | d k r�| d k rT| | j d d � k r.t | d <| d c d j | � 7<q�t | d <| d c d j | � 7<q�| d k r�t j | | j d d � � r�t | d <| d c d j | � 7<q�t | d <| d c d j | � 7<q�n | d k rP| j d
d � | k r*| d c d j | � 7<| d d k rMt | d <qMqP| d c d j | � 7<t | d <n t d t k r�d | d <| d c d 7<d | k r�| d c d j | d � 7<n | d c d 7<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
u nameu resultu u commentu changesu datauA Either match text (match) or a status code (status) is required.u decodeu textu statusu testu http.wait_for_successful_queryt wait_foru
http.queryu stringu Match text "{0}" was found.u Match text "{0}" was not found.u pcreu Match pattern "{0}" was found.u# Match pattern "{0}" was not found.u# Status {0} was found, as specified.u'