Bug #30371
closedSync plan time handling still doesn't behave as expected
Description
I know that some work has been done to fix the time "weirdness" around sync plans and that it stems from originally not storing timezone info, but there is still a lot of weirdness w/ Sync plan times...
Background¶
Katello: 3.15.2
Foreman: 2.0.1
Server Timezone: Arizona/Phoenix (MST UTC-0700)
Foreman User Profile Timezone: Browser timezone
My Browser Timezone: America/Denver (MDT UTC-0600)
Summary¶
This all started from setting a Sync plan up like:
$ hammer sync-plan update --name Daily --interval daily --sync-date 2011-06-12T03:05:00MST
I expected that to run last night at 03:05AM MDT but it instead ran at 09:05 MDT.
So lets see what hammer thinks about the next run.
$ hammer sync-plan update --name Daily --interval daily --sync-date 2011-06-12T03:05:00MST Sync plan updated. $ hammer sync-plan info --name Daily | grep Next Next Sync: 2020/07/11 10:05:00
(in UI) Next Sync: July 11, 2020, 04:05 AM
I suspect it'll run at 09:05:00 AM July 11 MDT.
It got even weirder when I tried to use cron schedules...
hammer + cron¶
$ hammer sync-plan update --name Daily --interval custom\ cron --cron-expression '05 03 * * *' Sync plan updated. $ hammer sync-plan info --name Daily | grep Next Next Sync: 2020/07/11 03:05:00
UI Shows Next Sync: July 10, 2020, 09:05 PM
UI + cron¶
Note: 03:06 because just saving "05 03 * * *" again doesn't cause a change
(in UI) Interval: Custom Cron
(in UI) Cron Expression: 06 03 * * *
(in UI) <SAVE>
(in UI) Next Sync: July 11, 2020, 03:06 AM
Ok, lets check hammer.
$ hammer sync-plan info --name Daily | grep Next Next Sync: 2020/07/11 09:06:00
Fine, go back to interval "daily" + sync date¶
hammer sync-plan update --name Daily --interval daily --sync-date 2011-06-12T03:05:00MST Sync plan updated. $ hammer sync-plan info --name Daily | grep Next Next Sync: 2020/07/11 10:05:00
(in UI) Next Sync: July 11, 2020, 04:05 AM
Thoughts¶
I could go on, I did a bunch more tests. More combinations of cron, setting the date at 2011-06-12T03:05:00 with and without timezone using hammer in the UI and on and on.
Expected behavior¶
I guess as a user what I expect is something like the following.
- Browser should show Next sync in my Browser's timezone or the one in my preferences.
- Hammer should show Next sync in my shell's timezone
- Cron expressions should ALWAYS be evaluated in the context of the server's timezone, that is the TZ of the process running katello.
Possible improvements¶
UI
- Show both browser time and server time (as calculated by the process running katello) in the UI
- If the user's timezone is NOT "Browser timezone" indicate that in the UI "from preferences" or something
- When entering time on the UI allow the user to choose "server time" or "local time" (browser time or preferred time)
Hammer
- Show both shell and server time in the "info" view, use UTC everywhere else (CSV)
- Be clear about TZ in --sync-date parameter, if no TZ provided then server timezone
- Document 'custom cron' is in the server's timezone