-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BSDTimezone: distinguish UTC and Etc/UTC #41234
Conversation
57f0734
to
d62f394
Compare
f5f5275
to
5e9296c
Compare
Adding tests reveals same problem exists in non-systemd linux... Maybe #34390 has something to do with the problem? The problem looks hard to fix, so I decided to skip the new tests on non-systemd managed debian/ubuntu. |
The test
|
d5fb452
to
0606c80
Compare
ready_for_review |
cc @maxamillion |
rebuild_merge |
* Fixed BSDTimezone to distinguish UTC and Etc/UTC * Added test for timezone to disinguish UTC vs Etc/UTC
SUMMARY
Improved idempotency of the
timezone
module on BSD.It used not to distinguish between UTC and Etc/UTC, because both represents a same timezone.
This doesn't matter on normal usage, but cause weird unwilling behavior on a specific configuration.
I fixed this to distinguish those timezones and not to determine the timezone depending on user's input, but just read only from environment
In addition to that, now the order of scanning
/usr/share/zoneinfo
when/etc/localtime
is copied rather than symlined is deterministic, and always returns same value.ISSUE TYPE
COMPONENT NAME
timezone
moduleANSIBLE VERSION
ADDITIONAL INFORMATION
I wrote the original code in #36715.
At that time, I was thinking that we can regard two timezones as same if their content in
/usr/share/zoneinfo/
are same, because wherever the file is coming, only the content of the/etc/localtime
decides how a system works.Under this thought, I implemented to determine the timezone depending on a user's input. If the specified timezone can be regarded same as current one, we no need to change anything, and actually we wouldn't.
However, this meddlesome mix-up brings somewhat weird behavior with such configuration:
Even though you set the timezone to
Etc/UTC
on the first step, and it actually reports "after" timezone isEtc/UTC
, you'll see the "before" timezone is reported asUTC
rather thanEtc/UTC
on the next step. The "before" value doesn't match the "after" value of the previous step.Now I know this is my bad on designing the logic.
The problem was originally addressed at #40739 (comment), by pointing out a failure of the integration test:
#40855 tried to fix this by modifying "strategy 2". However, it works only on an environment where
/usr/share/zoneinfo/Etc/UTC
is symlinked from/usr/share/zoneinfo/UTC
In the environment I tested, those files are physically separated and thus
sudo ansible-test integration --allow-destructive timezone -v
failed with the above error.Now, with the patch of this pr, all clear.
I also added some test cases to make things clear.