voxpupuli / puppet-systemd

Puppet module to manage systemd
https://forge.puppet.com/puppet/systemd
Apache License 2.0
52 stars 142 forks source link

Add support for timezone and hardware clock #462

Closed jcpunk closed 1 month ago

jcpunk commented 1 month ago

Pull Request (PR) description

Add support for timedatectl to set timezone and hardware clock

This Pull Request (PR) fixes the following issues

Fixes: #377

jcpunk commented 1 month ago

I almost went with

  if $set_local_rtc {
    exec { 'set local hardware clock to local time':
      command => 'timedatectl set-local-rtc 1',
      onlyif  => 'test $(timedatectl show | grep LocalRTC | cut -d= -f2) = no',
      path    => $facts['path'],
    }
  } else {
    exec { 'set local hardware clock to UTC time':
      command => 'timedatectl set-local-rtc 0',
      unless  => 'test $(timedatectl show | grep LocalRTC | cut -d= -f2) = no',
      path    => $facts['path'],
    }
  }

But that make the hardware clock explicitly managed when it wasn't before. I don't believe localtime is rational for POSIX system, but I'm not sure just pushing that on folks is the right call.

TheMeier commented 1 month ago

I would have preferred systemd::timedatectl to be not funneled through the main class, then the params could be non-optional. But the whole module is designed in that way, and others have different opinions on that ;)

So LGTM...

jcpunk commented 1 month ago

Changes merged.

jcpunk commented 1 month ago

In theory this is sorted.