File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/test.cpython-310.pyc
o
�N�g?4 � @ s� d Z ddlZddlZddlmZ ddlmZ dd� Zdd� Z d d
� Z
dd� Zd
d� Zddd�Z
ddd�Zddd�Zddd�Zdd� Z d dd�ZdS )!a�
Test States
===========
Provide test case states that enable easy testing of things to do with state
calls, e.g. running, calling, logging, output filtering etc.
.. code-block:: yaml
always-passes-with-any-kwarg:
test.nop:
- name: foo
- something: else
- foo: bar
always-passes:
test.succeed_without_changes:
- name: foo
always-fails:
test.fail_without_changes:
- name: foo
always-changes-and-succeeds:
test.succeed_with_changes:
- name: foo
always-changes-and-fails:
test.fail_with_changes:
- name: foo
my-custom-combo:
test.configurable_test_state:
- name: foo
- changes: True
- result: False
- comment: bar.baz
- warnings: A warning
is-pillar-foo-present-and-bar-is-int:
test.check_pillar:
- present:
- foo
- integer:
- bar
You may also use these states for controlled failure in state definitions, for example if certain conditions in
pillar or grains do not apply. The following state definition will fail with a message "OS not supported!" when
`grains['os']` is neither Ubuntu nor CentOS:
.. code-block:: jinja
{% if grains['os'] in ['Ubuntu', 'CentOS'] %}
# Your state definitions go here
{% else %}
failure:
test.fail_without_changes:
- name: "OS not supported!"
- failhard: True
{% endif %}
� N��SaltInvocationError)�_gen_tagc K s t | �S )a
.. versionadded:: 2015.8.1
A no-op state that does nothing. Useful in conjunction with the ``use``
requisite, or in templates which could otherwise be empty due to jinja
rendering.
name
A unique string to serve as the state's ID
)�succeed_without_changes)�name�kwargs� r �D/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/test.py�nopI s r
c K s |� dd�}| i d|d�}|S )zy
.. versionadded:: 2014.7.0
Returns successful
name
A unique string to serve as the state's ID
�comment�Success!T�r �changes�resultr )�get�r r r �retr r r r W s r c K s6 |� dd�}| i d|d�}td rd|d<