mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-11 03:31:29 -07:00
BSDTimezone: distinguish UTC and Etc/UTC (#41234)
* Fixed BSDTimezone to distinguish UTC and Etc/UTC * Added test for timezone to disinguish UTC vs Etc/UTC
This commit is contained in:
parent
b310b278be
commit
bcd6b5c6f8
2 changed files with 55 additions and 25 deletions
|
@ -81,6 +81,54 @@
|
|||
that:
|
||||
- not timezone_again_checkmode.changed
|
||||
|
||||
##
|
||||
## tests for same timezones with different names
|
||||
##
|
||||
|
||||
- name: check dpkg-reconfigure
|
||||
shell: type dpkg-reconfigure
|
||||
register: check_dpkg_reconfigure
|
||||
ignore_errors: yes
|
||||
changed_when: no
|
||||
|
||||
- name: check timedatectl
|
||||
shell: type timedatectl && timedatectl
|
||||
register: check_timedatectl
|
||||
ignore_errors: yes
|
||||
changed_when: no
|
||||
|
||||
- block:
|
||||
- name: set timezone to Etc/UTC
|
||||
timezone:
|
||||
name: Etc/UTC
|
||||
|
||||
- name: change timezone from Etc/UTC to UTC
|
||||
timezone:
|
||||
name: UTC
|
||||
register: timezone_etcutc_to_utc
|
||||
|
||||
- name: check timezone changed from Etc/UTC to UTC
|
||||
assert:
|
||||
that:
|
||||
- timezone_etcutc_to_utc.changed
|
||||
- timezone_etcutc_to_utc.diff.before.name == 'Etc/UTC'
|
||||
- timezone_etcutc_to_utc.diff.after.name == 'UTC'
|
||||
|
||||
- name: change timezone from UTC to Etc/UTC
|
||||
timezone:
|
||||
name: Etc/UTC
|
||||
register: timezone_utc_to_etcutc
|
||||
|
||||
- name: check timezone changed from UTC to Etc/UTC
|
||||
assert:
|
||||
that:
|
||||
- timezone_utc_to_etcutc.changed
|
||||
- timezone_utc_to_etcutc.diff.before.name == 'UTC'
|
||||
- timezone_utc_to_etcutc.diff.after.name == 'Etc/UTC'
|
||||
|
||||
when:
|
||||
# FIXME: Due to the bug of the dpkg-reconfigure, those tests failed on non-systemd debian
|
||||
- check_dpkg_reconfigure.rc != 0 or check_timedatectl.rc == 0
|
||||
|
||||
##
|
||||
## no systemd tests for timezone
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue