|
|
@ -218,6 +218,12 @@ class Timezone(object):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
self.abort('set(key, value) is not implemented on target platform')
|
|
|
|
self.abort('set(key, value) is not implemented on target platform')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _verify_timezone(self):
|
|
|
|
|
|
|
|
tz = self.value['name']['planned']
|
|
|
|
|
|
|
|
tzfile = '/usr/share/zoneinfo/%s' % tz
|
|
|
|
|
|
|
|
if not os.path.isfile(tzfile):
|
|
|
|
|
|
|
|
self.abort('given timezone "%s" is not available' % tz)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SystemdTimezone(Timezone):
|
|
|
|
class SystemdTimezone(Timezone):
|
|
|
|
"""This is a Timezone manipulation class systemd-powered Linux.
|
|
|
|
"""This is a Timezone manipulation class systemd-powered Linux.
|
|
|
@ -241,10 +247,7 @@ class SystemdTimezone(Timezone):
|
|
|
|
self.status = dict()
|
|
|
|
self.status = dict()
|
|
|
|
# Validate given timezone
|
|
|
|
# Validate given timezone
|
|
|
|
if 'name' in self.value:
|
|
|
|
if 'name' in self.value:
|
|
|
|
tz = self.value['name']['planned']
|
|
|
|
self._verify_timezone()
|
|
|
|
tzfile = '/usr/share/zoneinfo/%s' % tz
|
|
|
|
|
|
|
|
if not os.path.isfile(tzfile):
|
|
|
|
|
|
|
|
self.abort('given timezone "%s" is not available' % tz)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _get_status(self, phase):
|
|
|
|
def _get_status(self, phase):
|
|
|
|
if phase not in self.status:
|
|
|
|
if phase not in self.status:
|
|
|
@ -298,10 +301,7 @@ class NosystemdTimezone(Timezone):
|
|
|
|
super(NosystemdTimezone, self).__init__(module)
|
|
|
|
super(NosystemdTimezone, self).__init__(module)
|
|
|
|
# Validate given timezone
|
|
|
|
# Validate given timezone
|
|
|
|
if 'name' in self.value:
|
|
|
|
if 'name' in self.value:
|
|
|
|
tz = self.value['name']['planned']
|
|
|
|
self._verify_timezone()
|
|
|
|
tzfile = '/usr/share/zoneinfo/%s' % tz
|
|
|
|
|
|
|
|
if not os.path.isfile(tzfile):
|
|
|
|
|
|
|
|
self.abort('given timezone "%s" is not available' % tz)
|
|
|
|
|
|
|
|
self.update_timezone = self.module.get_bin_path('cp', required=True)
|
|
|
|
self.update_timezone = self.module.get_bin_path('cp', required=True)
|
|
|
|
self.update_timezone += ' %s /etc/localtime' % tzfile
|
|
|
|
self.update_timezone += ' %s /etc/localtime' % tzfile
|
|
|
|
self.update_hwclock = self.module.get_bin_path('hwclock', required=True)
|
|
|
|
self.update_hwclock = self.module.get_bin_path('hwclock', required=True)
|
|
|
|