mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix incorrect args passed to timezone.set_hwclock
On Gentoo, we should check the value passed in to timezone.set_hwclock and only allow 'UTC' or 'localtime' for argument. If incorrect value is passed in, it could subsequently fry the important config file. There is another closely related issue on Gentoo. The value to set 'clock' variable in the config file is either 'UTC' or 'local'. In case of localtime arg, we should convert the value of 'localtime' to 'local' when setting that 'clock' variable.
This commit is contained in:
parent
8a566ff4b9
commit
a41146730a
1 changed files with 6 additions and 0 deletions
|
@ -400,6 +400,12 @@ def set_hwclock(clock):
|
|||
elif clock == 'localtime':
|
||||
__salt__['file.sed']('/etc/default/rcS', '^UTC=.*', 'UTC=no')
|
||||
elif 'Gentoo' in __grains__['os_family']:
|
||||
if clock not in ('UTC', 'localtime'):
|
||||
raise SaltInvocationError(
|
||||
'Only \'UTC\' and \'localtime\' are allowed'
|
||||
)
|
||||
if clock.__eq__('localtime'):
|
||||
clock = 'local'
|
||||
__salt__['file.sed'](
|
||||
'/etc/conf.d/hwclock', '^clock=.*', 'clock="{0}"'.format(clock))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue