Job schedule using when with multiple dates not working #53604
Labels
Bug
broken, incorrect, or confusing behavior
doc-request
net new docs requested
Documentation
Relates to Salt documentation
severity-medium
3rd level, incorrect or bad functionality, confusing and lacks a work around
time-estimate-sprint
Milestone
Description of Issue
It is not possible to define job which must runs multiple times every day using salt schedule with
when
directive. If only single date/time is specified then everything works as expected.If job has defined multiple run hours and
schedule.reload
is executed then only hours after now are scheduled. Propablycron
directive could be used to achieve this but it requirespython2-croniter
package which is not a part of base RHEL/CentOS 7 in opposite topython-dateutil
which is a base package.I've managed to achieve working solutions by modifying
salt/utils/schedule.py
:But I'm not sure if it is a proper solution and do not break something else. Is it possible to fix it this way or am I misunderstanding something? Maybe just a hint in documentation should be added to clarify usage if it cannot be changed? If You agree to fix it then I could provide pull request with patch.
As a workaround for now I have defined multiple jobs with single
when
time definition instead of one job with multiple entries inwhen
directive.Setup
/srv/pillar/top.sls
Define hours before now in /srv/pillar/schedule.sls
Steps to Reproduce Issue
salt-call pillar.get schedule
salt-call schedule.reload
salt-call schedule.list
salt-call schedule.show_next_fire_time test
When defined
hours
are afternow
then it works as expected:salt-call schedule.list
salt-call schedule.show_next_fire_time test
Versions Report
The text was updated successfully, but these errors were encountered: