HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/thorium/__pycache__/check.cpython-310.pyc
o

�N�g
*�@s�dZddlZddlZe�e�Zdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Z						ddd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS) a.
The check Thorium state is used to create gateways to commands, the checks
make it easy to make states that watch registers for changes and then just
succeed or fail based on the state of the register, this creates the pattern
of having a command execution get gated by a check state via a requisite.
�NcCsN|ddid�}|tvrd|d<d|�d�|d<|St|d|kr%d	|d<|S)
aZ
    Only succeed if the value in the given register location is greater than
    the given value

    USAGE:

    .. code-block:: yaml

        foo:
          check.gt:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    F���name�result�comment�changesr�Value � not in registerr�valT��__reg__�r�value�ret�r�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/thorium/check.py�gt�rcCsN|ddid�}|tvrd|d<d|�d�|d<|St|d|kr%d	|d<|S)
ad
    Only succeed if the value in the given register location is greater or equal
    than the given value

    USAGE:

    .. code-block:: yaml

        foo:
          check.gte:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Trr
rrr�gte-rrcCsN|ddid�}|tvrd|d<d|�d�|d<|St|d|kr%d	|d<|S)
aW
    Only succeed if the value in the given register location is less than
    the given value

    USAGE:

    .. code-block:: yaml

        foo:
          check.lt:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Trr
rrr�ltKrrcCsN|ddid�}|tvrd|d<d|�d�|d<|St|d|kr%d	|d<|S)
aa
    Only succeed if the value in the given register location is less than
    or equal the given value

    USAGE:

    .. code-block:: yaml

        foo:
          check.lte:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Trr
rrr�lteirrcC�N|ddid�}|tvrd|d<d|�d�|d<|St|d|kr%d	|d<|S)
aV
    Only succeed if the value in the given register location is equal to
    the given value

    USAGE:

    .. code-block:: yaml

        foo:
          check.eq:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Trr
rrr�eq�rrcCsN|ddid�}|tvrd|d<d|�d�|d<|St|d|kr%d	|d<|S)
aZ
    Only succeed if the value in the given register location is not equal to
    the given value

    USAGE:

    .. code-block:: yaml

        foo:
          check.ne:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Trr
rrr�ne�rrcCsL|ddid�}|tvrd|d<d|�d�|d<|Sz�|p%|p%|p%|p%|p%|}	|	r�t|d�|�}
t�d	||
�d
|d<|rH|d|
|kM<|rT|d|
|kM<|r`|d|
|kM<|rl|d|
|kM<|rx|d|
|kM<|r�|d|
|kM<W|SW|S|t|dvr�d
|d<W|SW|Sty�Y|Sw)a[
    Only succeed if the value in the given register location contains
    the given value

    USAGE:

    .. code-block:: yaml

        foo:
          check.contains:
            - value: itni

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
z%s appears %s timesT)r�count�log�debug�	TypeError)rrZcount_ltZ	count_lteZcount_eqZ	count_gteZcount_gtZcount_nerZ
count_compareZoccurrencesrrr�contains�sH���
���rcCs8|iddd�}tD]}tjj�|d|�rd|d<q	|S)aP
    Chekcs for a specific event match and returns result True if the match
    happens

    USAGE:

    .. code-block:: yaml

        salt/foo/*/bar:
          check.event

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: salt/foo/*/bar
    rF)rrrr�tagTr)Z
__events__�salt�utilsZstringutilsZ
expr_match)rr�eventrrrr"s�r"cCsR|ddid�}|tvrd|d<d|�d�|d<|Stt|d�|kr'd	|d<|S)
a\
    Only succeed if length of the given register location is greater than
    the given value.

    USAGE:

    .. code-block:: yaml

        foo:
          check.len_gt:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
T�r�lenr
rrr�len_gt�r%cCsR|ddid�}|tvrd|d<d|�d�|d<|Stt|d�|kr'd	|d<|S)
ai
    Only succeed if the length of the given register location is greater or equal
    than the given value

    USAGE:

    .. code-block:: yaml

        foo:
          check.len_gte:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Tr#r
rrr�len_gte;r&r'cCsR|ddid�}|tvrd|d<d|�d�|d<|Stt|d�|kr'd	|d<|S)
a]
    Only succeed if the length of the given register location is less than
    the given value.

    USAGE:

    .. code-block:: yaml

        foo:
          check.len_lt:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Tr#r
rrr�len_ltYr&r(cCsR|ddid�}|tvrd|d<d|�d�|d<|Stt|d�|kr'd	|d<|S)
af
    Only succeed if the length of the given register location is less than
    or equal the given value

    USAGE:

    .. code-block:: yaml

        foo:
          check.len_lte:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Tr#r
rrr�len_ltewr&r)cCr)
a\
    Only succeed if the length of the given register location is equal to
    the given value.

    USAGE:

    .. code-block:: yaml

        foo:
          check.len_eq:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Trr
rrr�len_eq�rr*cCsR|ddid�}|tvrd|d<d|�d�|d<|Stt|d�|kr'd	|d<|S)
a`
    Only succeed if the length of the given register location is not equal to
    the given value.

    USAGE:

    .. code-block:: yaml

        foo:
          check.len_ne:
            - value: 42

        run_remote_ex:
          local.cmd:
            - tgt: '*'
            - func: test.ping
            - require:
              - check: foo
    Frrrrr	rr
Tr#r
rrr�len_ne�r&r+)NNNNNN)�__doc__�loggingZsalt.utils.stringutilsr �	getLogger�__file__rrrrrrrrr"r%r'r(r)r*r+rrrr�<module>s0
!
�>