Bug #36216
closedComplex Cronline do not work
Description
We’re trying to create some Recurring Logic that require complex Cronlines.
For example, we want to install updates on a subset of the machines on the second Tuesday of every month.
The Cronline for this situation looks like this:
0 8 7-14 * */2https://crontab.guru/#0_8_8-14_*_*/2
irb(main):002:0> ForemanTasks::RecurringLogic.find(30) => #<ForemanTasks::RecurringLogic id: 30, cron_line: “0 8 7-14 * */2”, end_time: nil, max_iteration: nil, iteration: 1, task_group_id: 146, state: “active”, triggering_id: 80, purpose: nil>
At 08AM, on the days between the 7th and 14th (all possible days where the second Tuesday of the month can fall), on every month, on every second day of the week.
We also tested:
0 8 7-14 * 2https://crontab.guru/#0_8_8-14_*_2
irb(main):004:0> ForemanTasks::RecurringLogic.find(35) => #<ForemanTasks::RecurringLogic id: 35, cron_line: “0 8 8-14 * 2”, end_time: nil, max_iteration: nil, iteration: 1, task_group_id: 159, state: “active”, triggering_id: 86, purpose: nil>
Which is similar as the one above but instead of on every second day of the week it’s on Tuesday, but not even the crontab.guru shows the expected date of the next occurrence.
On the community forum ( https://community.theforeman.org/t/complex-cronline-do-not-work/32445 ) someone pointed out that the problem is with the cron parser library that has some known issues and it is not updated since 2016.