File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/schedule.cpython-310.pyc
o
�N�g�1 � @ s( d Z dd� Zdd� Zdd� Zdd� Zd S )
a�
Management of the Salt scheduler
==============================================
.. code-block:: yaml
job3:
schedule.present:
- function: test.ping
- seconds: 3600
- splay: 10
This will schedule the command: test.ping every 3600 seconds
(every hour) splaying the time between 0 and 10 seconds
.. code-block:: yaml
job2:
schedule.present:
- function: test.ping
- seconds: 15
- splay:
start: 10
end: 20
This will schedule the command: test.ping every 15 seconds
splaying the time between 10 and 20 seconds
.. code-block:: yaml
job1:
schedule.present:
- function: state.sls
- job_args:
- httpd
- job_kwargs:
test: True
- when:
- Monday 5:00pm
- Tuesday 3:00pm
- Wednesday 5:00pm
- Thursday 3:00pm
- Friday 5:00pm
This will schedule the command: state.sls httpd test=True at 5pm on Monday,
Wednesday and Friday, and 3pm on Tuesday and Thursday. Requires that
python-dateutil is installed on the minion.
.. code-block:: yaml
job1:
schedule.present:
- function: state.sls
- job_args:
- httpd
- job_kwargs:
test: True
- cron: '*/5 * * * *'
Scheduled jobs can also be specified using the format used by cron. This will
schedule the command: state.sls httpd test=True to run every 5 minutes. Requires
that python-croniter is installed on the minion.
.. code-block:: yaml
job1:
schedule.present:
- function: state.sls
- job_args:
- httpd
- job_kwargs:
test: True
- when:
- Monday 5:00pm
- Tuesday 3:00pm
- Wednesday 5:00pm
- Thursday 3:00pm
- Friday 5:00pm
- returner: xmpp
- return_config: xmpp_state_run
- return_kwargs:
recipient: user@domain.com
This will schedule the command: state.sls httpd test=True at 5pm on Monday,
Wednesday and Friday, and 3pm on Tuesday and Thursday. Using the xmpp returner
to return the results of the scheduled job, with the alternative configuration
options found in the xmpp_state_run section.
.. code-block:: yaml
job1:
schedule.present:
- function: state.sls
- job_args:
- httpd
- job_kwargs:
test: True
- hours: 1
- skip_during_range:
- start: 2pm
- end: 3pm
- run_after_skip_range: True
This will schedule the command: state.sls httpd test=True at 5pm on Monday,
Wednesday and Friday, and 3pm on Tuesday and Thursday. Requires that
python-dateutil is installed on the minion.
c K s | di g d�}t d dd|�d�d�}| |v r�t d | fi |��}t|t�rDd|v r<|d s<|d |d<