mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
BSD UTC timezone is not always idempotent (#40855)
Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
parent
7f8654d586
commit
c65f3fdca6
1 changed files with 7 additions and 3 deletions
|
@ -70,7 +70,6 @@ EXAMPLES = '''
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
import filecmp
|
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import random
|
import random
|
||||||
|
@ -711,12 +710,17 @@ class BSDTimezone(Timezone):
|
||||||
# but it's intended to avoid useless diff.
|
# but it's intended to avoid useless diff.
|
||||||
planned = self.value['name']['planned']
|
planned = self.value['name']['planned']
|
||||||
try:
|
try:
|
||||||
already_planned_state = filecmp.cmp(os.path.join(zoneinfo_dir, planned), localtime_file)
|
planned_zonefile = os.path.join(zoneinfo_dir, planned)
|
||||||
|
already_planned_state = filecmp.cmp(planned_zonefile, localtime_file)
|
||||||
|
|
||||||
except OSError:
|
except OSError:
|
||||||
# Even if reading planned zoneinfo file gives an OSError, don't abort here,
|
# Even if reading planned zoneinfo file gives an OSError, don't abort here,
|
||||||
# because a bit more detailed check will be done in `set`.
|
# because a bit more detailed check will be done in `set`.
|
||||||
already_planned_state = False
|
already_planned_state = False
|
||||||
if already_planned_state:
|
# Handle the case where the file comp previously would claim UTC and Etc/UTC
|
||||||
|
# are the same because they are the same file, but not the same path. This
|
||||||
|
# breaks idempotent task runs.
|
||||||
|
if already_planned_state and (planned_zonefile == os.path.realpath(planned_zonefile)):
|
||||||
return planned
|
return planned
|
||||||
|
|
||||||
# Strategy 3:
|
# Strategy 3:
|
||||||
|
|
Loading…
Reference in a new issue