Ensure timezone tests reset system timezone to original value (#39326)

(cherry picked from commit fda67bae50)
pull/39938/head
Sam Doran 7 years ago committed by Matt Clay
parent f4dc8596fa
commit a8c823e813

@ -1,15 +1,21 @@
- name: set timezone to Etc/UTC - name: Set timezone to Etc/UTC
timezone: timezone:
name: Etc/UTC name: Etc/UTC
register: original_timezone
- name: set timezone to Australia/Brisbane - block:
- name: Set timezone to Australia/Brisbane
timezone: timezone:
name: Australia/Brisbane name: Australia/Brisbane
register: timezone_set register: timezone_set
- name: ensure timezone changed - name: Ensure timezone changed
assert: assert:
that: that:
- timezone_set.changed - timezone_set is changed
- timezone_set.diff.after.name == 'Australia/Brisbane' - timezone_set.diff.after.name == 'Australia/Brisbane'
- timezone_set.diff.before.name == 'Etc/UTC' - timezone_set.diff.before.name == 'Etc/UTC'
always:
- name: Restore original system timezone - {{ original_timezone.diff.before.name }}
timezone:
name: "{{ original_timezone.diff.before.name }}"

Loading…
Cancel
Save