1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[timezone module] Return tzfile from _verify_timezone (fix #19745)

Modification picked from https://github.com/ansible/ansible-modules-extras/pull/3337
This commit is contained in:
tmshn 2017-01-03 18:06:54 +09:00 committed by Brian Coca
parent 3ebbcbadcf
commit 6a6113e951

View file

@ -229,6 +229,7 @@ class Timezone(object):
tzfile = '/usr/share/zoneinfo/%s' % tz
if not os.path.isfile(tzfile):
self.abort('given timezone "%s" is not available' % tz)
return tzfile
class SystemdTimezone(Timezone):
@ -307,7 +308,7 @@ class NosystemdTimezone(Timezone):
super(NosystemdTimezone, self).__init__(module)
# Validate given timezone
if 'name' in self.value:
self._verify_timezone()
tzfile = self._verify_timezone()
self.update_timezone = self.module.get_bin_path('cp', required=True)
self.update_timezone += ' %s /etc/localtime' % tzfile
self.update_hwclock = self.module.get_bin_path('hwclock', required=True)