Giter Club home page Giter Club logo

puppet-timezone's Introduction

puppet-timezone CI

Manage timezone settings via Puppet

Usage

Set timezone to UTC

    class { 'timezone':
        timezone => 'UTC',
    }

Set timezone to Europe/Berlin

    class { 'timezone':
        timezone => 'Europe/Berlin',
    }

Other class parameters

  • ensure: present or absent, default: present
  • autoupgrade: true or false, default: false. Auto-upgrade package, if there is a newer version
  • hwutc: true or false, default: undef. This parameter will ensure that the real time clock is set to UTC rather than the local timezone. This is not supported on all platforms and will fail if you try and set it on an unsupported platform. A typical error message from the timedatectl command, if this value is set to false would be:
Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

puppet-timezone's People

Contributors

bhundven avatar blake avatar caarlos0 avatar cataphract avatar dgolja avatar emilienm avatar flameeyes avatar gerapeldoorn avatar ggeldenhuis avatar hajee avatar jamorales85 avatar jkroepke avatar jlambert121 avatar lindsay-apitalent avatar lmello avatar mcanevet avatar mklauber avatar morremeyer avatar mpdude avatar mwhahaha avatar paescuj avatar sagepe avatar saz avatar strider avatar t-8ch avatar themeier avatar timdeluxe avatar tnmt avatar treydock avatar yakatz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

puppet-timezone's Issues

deprecation warnings on validate_bool

Hey, I just installed a new puppet machine. I'm using module puppetlabs-stdlib (v4.17.1) and saz-timezone (v3.5.0). When trying to set a timezone, I get a deprecation warning:

Warning: This method is deprecated, please use the stdlib validate_legacy function, with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README. at ["/etc/puppetlabs/code/environments/production/modules/timezone/manifests/init.pp", 56]:
(at /etc/puppetlabs/code/environments/production/modules/stdlib/lib/puppet/functions/deprecation.rb:25:in `deprecation')

It seems this code:

validate_bool($hwutc)
validate_bool($autoupgrade)

Should be updated to match the newer stdlib behaviour since puppet 3 is deprecated?

edit: this seems to fix the deprecation warnings:

validate_legacy(Boolean, 'validate_bool', $hwutc)
validate_legacy(Boolean, 'validate_bool', $autoupgrade)

Timezone processing is triggered on every update on Debian

Please consider configuration and it results:

    class { '::timezone':
        timezone => 'UTC',
    }
Notice: /Stage[main]/Timezone/File[/etc/timezone]/content: 
--- /etc/timezone       2015-05-20 14:33:55.475440368 +0000
+++ /tmp/puppet-file20150522-18306-1exjari      2015-05-22 11:41:13.662396982 +0000
@@ -1 +1,2 @@
-Etc/UTC
+# Managed by puppet - do not modify
+UTC

Info: Computing checksum on file /etc/timezone
Info: FileBucket got a duplicate file {md5}4f24b133ba38d8fd565168742c9aedeb
Info: /Stage[main]/Timezone/File[/etc/timezone]: Filebucketed /etc/timezone to puppet with sum 4f24b133ba38d8fd565168742c9aedeb
Notice: /Stage[main]/Timezone/File[/etc/timezone]/content: content changed '{md5}4f24b133ba38d8fd565168742c9aedeb' to '{md5}ee3a680deca3b3a0f7667a1a70b093ff'
Info: /Stage[main]/Timezone/File[/etc/timezone]: Scheduling refresh of Exec[update_timezone]
Notice: /Stage[main]/Timezone/Exec[update_timezone]: Triggered 'refresh' from 1 events
Info: Computing checksum on file /etc/localtime
Info: FileBucket got a duplicate file {md5}c79354b8dbee09e62bbc3fb544853283
Info: /Stage[main]/Timezone/File[/etc/localtime]: Filebucketed /etc/localtime to puppet with sum c79354b8dbee09e62bbc3fb544853283
Notice: /Stage[main]/Timezone/File[/etc/localtime]/ensure: ensure changed 'file' to 'link'

Please note UTC -> Etc/UTC change and "file" to "link" change in /etc/localtime.

The temporary solution below works as expected:

    file { '/etc/timezone':
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        content => "Etc/UTC\n",
    }

    exec { '/usr/sbin/dpkg-reconfigure -f noninteractive tzdata':
        creates => '/etc/localtime',
        subscribe => File['/etc/timezone'],
        refreshonly => true
    }
}

Result:

root@TESTHOST:~# dpkg-reconfigure tzdata

Current default time zone: 'Etc/Universal'
Local time is now:      Fri May 22 11:49:20 UTC 2015.
Universal Time is now:  Fri May 22 11:49:20 UTC 2015.

root@TESTHOST:~# dpkg-reconfigure 
/usr/sbin/dpkg-reconfigure: please specify a package to reconfigure
root@TESTHOST:~# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for TESTHOST
Info: Applying configuration version '1432295346'
Notice: /Stage[main]/Basesystem::Timezone/File[/etc/timezone]/content: 
--- /etc/timezone       2015-05-22 11:49:20.508924199 +0000
+++ /tmp/puppet-file20150522-26087-pxd7dq       2015-05-22 11:49:31.733351358 +0000
@@ -1 +1 @@
-Etc/Universal
+Etc/UTC

Info: Computing checksum on file /etc/timezone
Info: /Stage[main]/Basesystem::Timezone/File[/etc/timezone]: Filebucketed /etc/timezone to puppet with sum dbb7e95c52a24460cc98a1e41d9f94fe
Notice: /Stage[main]/Basesystem::Timezone/File[/etc/timezone]/content: content changed '{md5}dbb7e95c52a24460cc98a1e41d9f94fe' to '{md5}4f24b133ba38d8fd565168742c9aedeb'
Info: /Stage[main]/Basesystem::Timezone/File[/etc/timezone]: Scheduling refresh of Exec[/usr/sbin/dpkg-reconfigure -f noninteractive tzdata]
Notice: /Stage[main]/Basesystem::Timezone/Exec[/usr/sbin/dpkg-reconfigure -f noninteractive tzdata]: Triggered 'refresh' from 1 events
Notice: Finished catalog run in 0.68 seconds
root@TESTHOST:~# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for TESTHOST
Info: Applying configuration version '1432295346'
Notice: Finished catalog run in 0.57 seconds
root@TESTHOST:~#

Please consider adapting/integrating the logic for Debian.

/etc/timezone is updated on every Puppet execute on Debian

Every time the Puppet Agent is executed, the /etc/timezone file is updated.

Example of the output (note: the from and to are consistent between runs)
Notice: /Stage[main]/Timezone/File[/etc/timezone]/content: content changed '{md5}4f24b133ba38d8fd565168742c9aedeb' to '{md5}ae1d80ba85332ae2d9fbbd491b17c043' Info: /Stage[main]/Timezone/File[/etc/timezone]: Scheduling refresh of Exec[update_timezone]

Module Version: 4.0.1
Puppet Version: 4.8.2
System: Debian 9.1 x64

Symbolic link /etc/localtime not managed correctly

The creaton of the symbolic link /etc/localtime doesn't work correctly in the latest release.

I have a server where /etc/localtime is a regular file and the module does not create a symbolic link to replace the file. The cause is probably the file resource that manages the link:

file { $localtime_file:
  ensure => $localtime_ensure,
  source => "${zoneinfo_dir}/${timezone}",
  notify => $notify_services,
}

The documentation of the file resource says:

link ensures the file is a symlink, and requires that you also set the target attribute

So source should probably be target here.

Can this module take params from an ENC?

Hi,
I'm using Foreman as a Puppet ENC, Foreman has capabilities to apply parameters dynamically based on metadata like location, domain, or logical node groups. Anyway, it seems as though this module won't take the timezone param from the ENC.

Location A sets the timezone param to America/New_York, Location B sets it to America/Los_Angeles. Nodes in Location A have yaml like

classes:
  timezone
parameters:
  timezone_timezone: America/New_York
environment: production

The timezone always takes the default UTC param. If I set it manually on a host with timedatectl, puppet sets it back to UTC.

Do you have any ideas?

As CentOS is dead, we migrating to Rocky, we need suport for it

Hello, hello.
First thank you for your effort about writing this nice module. Everything about it simply works, except the fact we need support for modern distributions like Rocky ;-)

I tried to roll out today on Rocky and got this error:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Unsupported platform: Rocky (file: /etc/puppetlabs/code/environments/production/modules/locales/manifests/params.pp, line: 103, column: 7) on node scout.home.lan
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

So I'm kindly pleasing you to add that support to the selector when you have time.
Thanks in advance.

Timezone keeps updating on Debian

When applying the timezone class on my Debian 7 system, every agent run will result in a refresh of /etc/timezone. What happens is:

/etc/timezone contains:

Europe/Amsterdam

Agent runs, replaces the content with:

# Managed by puppet - do not modify
Europe/Amsterdam

Agent runs dpkg-reconfigure -f noninteractive tzdata, which rewrites /etc/timezone:

Europe/Amsterdam

This repeats itself every time the manifest is applied.

Not sure how this is handled on other systems, but for Debian the file (and thus the template) should not contain anything other than the time zone string.

For now, I've worked around this by doing:

$zone = hiera('timezone')
if $zone != $::timezone {
   class { timezone: timezone => $zone }
}

Nonidempotent updates

I was trying the latest v5.0.0. However, it was nonidempotent:

[root@xxx-xxx-xxx-xxx production]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for xxx-xxx-xxx-xxx.internal
Info: Applying configuration version '1530392363'
Notice: /Stage[main]/Timezone/Exec[update_timezone]/returns: executed successfully
Notice: Applied catalog in 0.28 seconds
[root@xxx-xxx-xxx-xxx production]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for xxx-xxx-xxx-xxx.internal
Info: Applying configuration version '1530392509'
Notice: /Stage[main]/Timezone/Exec[update_timezone]/returns: executed successfully
Notice: Applied catalog in 0.26 seconds
[root@xxx-xxx-xxx-xxx production]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for xxx-xxx-xxx-xxx.internal
Info: Applying configuration version '1530392605'
Notice: /Stage[main]/Timezone/Exec[update_timezone]/returns: executed successfully
Notice: Applied catalog in 0.30 seconds
[root@xxx-xxx-xxx-xxx production]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for xxx-xxx-xxx-xxx.internal
Info: Applying configuration version '1530392613'
Notice: /Stage[main]/Timezone/Exec[update_timezone]/returns: executed successfully
Notice: Applied catalog in 0.27 seconds

When I downgraded in my Puppetfile to v4.1.1:

mod 'timezone',
  :git          => 'https://github.com/saz/puppet-timezone.git',
  :ref          => 'v4.1.1',
  :install_path => 'modules'

Everything worked:

[root@xxx-xxx-xxx-xxx production]# /usr/local/bin/r10k puppetfile install
[root@xxx-xxx-xxx-xxx production]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for xxx-xxx-xxx-xxx.internal
Info: Applying configuration version '1530392801'
Notice: Applied catalog in 0.24 seconds
[root@xxx-xxx-xxx-xxx production]# puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Info: Caching catalog for xxx-xxx-xxx-xxx.internal
Info: Applying configuration version '1530392810'
Notice: Applied catalog in 0.27 seconds

Comment that file is managed by Puppet

Files like /etc/sysconfig/clock should have a commented first line saying "# File managed by Puppet", to stop puppet-unaware sysadmins from changing the file manually.

Ubuntu error - debconf-get-selections

When puppet runs the following error is reported under Ubuntu 16.04

Error: /Stage[main]/Timezone/Exec[update_debconf area]: Could not evaluate: Could not find command 'debconf-get-selections'
Error: /Stage[main]/Timezone/Exec[update_debconf zone]: Could not evaluate: Could not find command 'debconf-get-selections'

This is because the package debconf-utils is not installed as a default in Ubuntu 16.04, this module requires it so really should install it to work.

The module should move to data in modules

This modules' params.pp is a prime candidate for data in modules. Moving will make the entire module a LOT cleaner overall and easier for users to understand as we move to a Puppet 5 world.

Unable to install with librarian-puppet

It seems that the metadata.json somehow upsets librarian puppet. I have forked deleted it, and installed using librarian puppet.

If I use librarian puppet I get:
/etc/puppet/vendor/ruby/1.9.1/gems/her-0.7.4/lib/her/model/attributes.rb:192: stack level too deep (SystemStackError)

Which looks like it doesn't like the name "saz-timezone". If I change the name to "saz-tzone" it works.

OS: Ubuntu 14.04.2
Standard ruby.
New install.

No version of 'saz-timezone' can satisfy all dependencies

hi,

I've tried to install the module but it will not work:

puppet module install saz-timezone --version 5.1.1
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Error: Could not install module 'saz-timezone' (???)
  No version of 'saz-timezone' can satisfy all dependencies
    Use `puppet module install --ignore-dependencies` to install only this module

this is installed at the moment:

puppet module list
/etc/puppetlabs/code/environments/production/modules
├── chrekh-hosts (v2.4.0)
├── fraenki-sshkeys (v0.9.3)
├── puppet-selinux (v1.6.1)
├── puppetlabs-ntp (v7.4.0)
├── puppetlabs-stdlib (v5.2.0)
├── saz-rsyslog (v5.0.0)
├── saz-timezone (v5.1.1)
├── stahnma-epel (v1.3.1)
└── stm-debconf (v2.3.0)
puppet --version
5.5.14

I can't find a dependencies issue? any ideas whats wrong?
If i try to install it without an specific version, it will install version 2:

puppet module install saz-timezone
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└── saz-timezone (v2.0.0)

thanks for your help!

cheers, Ringo

Setting timezone fails in CentOS Docker

On the 5.x version of puppet-timezone, it can no longer set the timezone in a Docker container. It throws a message similar to:

[root@054e74102ec0 /]# timedatectl set-timezone UTC
Failed to create bus connection: No such file or directory

Rolling back to 4.1.1 seems to fix the issue. Is there a work around?

no timezone_update_check_cmd provied for SLES

On SLES systems, if you try to set timezone using 5.0.2 you will get a catalog failure due to variable lookup failure:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Function lookup() did not find a value for the name 'timezone::timezone_update_check_cmd' on node

sles12+ can use same cmd being used for redhat 7 and then sles11 could use the old timezone_file method like redhat 6.

stm-debconf v6.0.0 Released

Can you change the dependence on stm-debconf please:

From
"version_requirement": ">= 2.0.0 < 6.0.0"
To
"version_requirement": ">= 2.0.0 < 7.0.0"

Thanks

Bad behavior when target is symlink

I've got strange behavior when trying to sets timezone != Europe/Berlin, e.g: Europe/Moscow.

All fine when

class { 'timezone':
    timezone => 'Europe/Berlin',
}
# file -s /etc/localtime 
/etc/localtime: timezone data, version 2, 9 gmt time flags, 9 std time flags, no leap seconds, 145 transition times, 9 abbreviation chars

And broken symlink with:

class { 'timezone':
    timezone => 'Europe/Moscow',
}

Result:

# puppet agent -t
...
Notice: /Stage[main]/Timezone/Exec[update_debconf zone]/returns: executed successfully
Notice: /Stage[main]/Timezone/File[/etc/timezone]/content: 
--- /etc/timezone       2016-07-19 16:22:30.535974939 +0200
+++ /tmp/puppet-file20160719-14474-1c1w1fo      2016-07-19 16:23:24.111968412 +0200
@@ -1 +1 @@
-Europe/Berlin
+Europe/Moscow

Info: Computing checksum on file /etc/timezone
Info: /Stage[main]/Timezone/File[/etc/timezone]: Filebucketed /etc/timezone to puppetmaster with sum 749357f70f40574f632071ec7d5f41a9
Notice: /Stage[main]/Timezone/File[/etc/timezone]/content: content changed '{md5}749357f70f40574f632071ec7d5f41a9' to '{md5}fa68dd8e32fd0b0c7e6e776736260abd'
Info: /Stage[main]/Timezone/File[/etc/timezone]: Scheduling refresh of Exec[update_timezone]
Notice: /Stage[main]/Timezone/Exec[update_timezone]: Triggered 'refresh' from 1 events
Notice: /Stage[main]/Timezone/File[/etc/localtime]/target: target changed '/usr/share/zoneinfo/Europe/Moscow' to '../W-SU'
Notice: Applied catalog in 2.89 seconds
# file -s /etc/localtime 
/etc/localtime: broken symbolic link to ../W-SU
# readlink /etc/localtime 
../W-SU
# file -s /usr/share/zoneinfo/Europe/Moscow
/usr/share/zoneinfo/Europe/Moscow: symbolic link to ../W-SU

System: Ubuntu 16.04 LTS, puppet4, master-branch from saz/puppet-timezone

Double // in the symlink path can cause issue with JVM applications

There is a double // in the path of the symlink:
String $zoneinfo_dir = '/usr/share/zoneinfo/',
file { $localtime_file:
target => "${zoneinfo_dir}/${timezone}",

It works for most of applications including the OS.
But it doesn't work for JVM applications.
Replacing the double // by a single / fix the issue.

Module is causing systemd timedate service to restart on every run.

Hi Saz,

I have been investigating intermittent dropped SSL connection issues on RHEL7 systems. In doing so, I noticed the following logs for every single puppet run. I have narrowed the issue down to this module (no longer happens if I remove the module). I've looked through your code and for the life of me, I can't figure out why the service is getting restarted (your set-timezone exec looks good to me). Running puppet in trace & debug says that puppet wouldn't do the action to set the timezone.

The dropped SSL connection issue happened at exactly the same time puppet ran. I'm wondering if restarting the time & date service has modified the system clock and caused the SSL library to drop connection(s).

Jul 18 05:10:43 host-01 dbus[2530]: [system] Activating via systemd: service name='org.freedesktop.timedate1' unit='dbus-org.freedesktop.timedate1.service'
Jul 18 05:10:43 host-01 systemd: Starting Time & Date Service...
Jul 18 05:10:43 host-01 dbus[2530]: [system] Successfully activated service 'org.freedesktop.timedate1'

Thanks for your time.
Nick

Verification of timezone settings

This might be over engineering but it would be cool if the module could verify that the timezone data you have set is actually correct and exists, and if not give you a warning. All the information is available on a Linux box but not sure how easily accessable it would be or if it would cause major slow down of the catalogue/facts compilation

Install debconf-utils on debian

On debian 8+9, debconf-get-selections is in the debconf-utils package which is not installed by default, so it should be added as a package dependency on those systems.

Update tzdata

I think you always want the latest tzdata. So:

        package { 'tzdata':
            ensure => latest,
            before => File['/etc/localtime'],
        }

Accidental break in `master`?

In #37, a new dependency was added (stm-debconf) to replace a few exec resources that were calling debconf-get-selections. This module ensures that necessary packages are installed.

In #48, it looks like the change from exec to debconf resources was (accidentally?) reverted, re-introducing the issues reported (and resolved) in #28. I believe it's accidental because the project still "depends" (metadata.json) on stm-debconf.

Is this intentional? If so, could this be patched in master?

Timezones with links are broken on ubuntu 16.04

If I try:

  class { timezone:
    timezone => 'America/Los_Angeles',
  }

When run puppet says this:

Notice: /Stage[main]/Timezone/File[/etc/localtime]/target: target changed '/usr/share/zoneinfo/America/Los_Angeles' to '../US/Pacific'

So the result is:

$ ls -al /etc/localtime 
lrwxrwxrwx 1 root root 13 Nov 29 05:22 /etc/localtime -> ../US/Pacific

But /etc/localtime using a relative link of ../US/Pacific results in /US/Pacific which doesn't exist there, but instead in /usr/share/zoneinfo.

However this works (it's not a link):

class { timezone:
    timezone => 'US/Pacific'
}

The problem is the timezone breaks if the /usr/share/timezone file is a link. In particular America/Los_Angeles is a link to ../US/Pacific. But the timezone is a relative link and it doesn't work from /etc.

This is on ubuntu-16.04.

timezone update

Hello,

i was wondering how this module handle timezone changes ? So for example if I bootstrap my server with TIMEZONE_1 and later on decide to change it to TIMEZONE_2, shouldn't you run (Debian for example) something like dpkg-reconfigure --frontend noninteractive tzdata ?

cheers

Setting timezone => 'Europe/London' results in UTC

Good Afternoon,
Using masterless Puppet 3.8.7
Whatever I set timezone to in the manifest, it gets set to UTC:

Here is the manifest:
[vagrant@dev01 control-repo]$ cat site/profiles/manifests/timezone.pp
class { 'timezone':
timezone => 'Europe/London',
}

Here I set the TZ to Europe/Berlin:
[root@web-01 puppet]# rm /etc/localtime
rm: remove symbolic link ‘/etc/localtime’? y
[root@web-01 puppet]# ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime

I run Puppet and it sets UTC:
[root@web-01 puppet]# puppet apply --modulepath=/etc/puppet/modules:/etc/puppet/site /etc/puppet/manifests/site.pp --debug
...
Debug: Class[Common]: The container Class[Profiles::Base] will propagate my refresh event
Debug: /Stage[main]/Timezone/File[/etc/localtime]: Removing existing link for replacement with /usr/share/zoneinfo/UTC
Notice: /Stage[main]/Timezone/File[/etc/localtime]/target: target changed '/usr/share/zoneinfo/Europe/Berlin' to '/usr/share/zoneinfo/UTC'
Debug: /Stage[main]/Timezone/File[/etc/localtime]: The container Class[Timezone] will propagate my refresh event

I have checked for a UTC setting in any other manifests and hiera - nothing there.
Any help would be welcome

Kind Regards
Mark

commit b15c576b2f6e9690dac75f2d7cb89079ebeb155a broke this module

 Evaluation Error: Unknown variable: 'exec_unless'. (file: /home/xxx/git/camelot/puppet-xxx_controlrepo/spec/fixtures/modules/timezone/manifests/init.pp, line: 126, column: 8) on node 

There are references to variables which are no longer defined.

manifests/init.pp:    if $exec_unless {
manifests/init.pp:      $unless_cmd = sprintf($exec_unless, $timezone)

Include mode for /etc/localtime

Something on the RHEL 6 builds I am working with sets the mode of /etc/localtime to 0777
Could a mode line be added to the resource def ?
Please ?

Support 7

Because version_requirement is set to ">= 5.0.0 < 7.0.0" in metadata.json file, puppet 7 is not supported.

I am not familiar with your code base, but most probably, the code will just work on puppet 7 version, so you can adjust the version_requirement accordingly.

Use timedatectl for RedHat 7

Shouldn't you use the 'timedatectl set-timezone ' command to manage the timezone on RedHat 7 osfamilies as well?

Using this command is recommended way by RedHat to set or update the local timezone on the system.

FreeBSD tries to install package tzdata.

On FreeBSD 11.1, puppet version 4.10, when I include timezone in my puppet modules include ::timezone, by default the module tries to install the package tzdata.

Could not update: Execution of '/usr/local/sbin/pkg install -qy tzdata' returned 70: pkg: No packages available to install matching 'tzdata' have been found in the repositories
change from absent to latest failed: Could not update: Execution of '/usr/local/sbin/pkg install -qy tzdata' returned 70: pkg: No packages available to install matching 'tzdata' have been found in the repositories

Unknown function validate_bool

Perhaps I've missed some dependency as I'm quite new to Puppet. But in Geppetto it there is an error on line 56 of init.pp which says "Unknown function validate_bool". I also see this error when I try and apply the module.

Puppet 6 support

Hi,

Dont't know if it needs other changes other than metadata.

Thanks.

Error when filebucketing /etc/localtime

Possibly because of https://tickets.puppetlabs.com/browse/PUP-1334?

Also could be because changing from file to symlink?

before:
-rw-r--r--. 1 root root 3543 Nov 20 15:58 /etc/localtime

after:
lrwxrwxrwx 1 root root 35 Apr 20 23:29 /etc/localtime -> /usr/share/zoneinfo/America/Chicago

Output:

Info: Applying configuration version 'ca129a826365903363f5ee990f92006e404a6054'
Info: Computing checksum on file /etc/localtime
Error: Could not back up /etc/localtime: Error 400 on SERVER: Got passed new contents for sum {md5}5f043232843c6d067008d64a60bcff51
Error: Could not back up /etc/localtime: Error 400 on SERVER: Got passed new contents for sum {md5}5f043232843c6d067008d64a60bcff51
Error: /Stage[main]/Timezone/File[/etc/localtime]/ensure: change from file to link failed: Could not back up /etc/localtime: Error 400 on SERVER: Got passed new contents for sum {md5}5f043232843c6d067008d64a60bcff51

Support puppet 5

Because of version_requirement >= 4.9.1 < 5.0.0 in metadata.json, puppet 5 is not supported.

Most probably, this will just work on puppet 5, and the version requirement can be updated to < 6.0.0

Non idempotent on trusty64

I've ran version 4.1.1 - 5.0.2, and have the following nonidempotent scenario for trusty64:

root@vagrant-ubuntu-trusty-64:/home/vagrant# /opt/puppetlabs/bin/puppet agent -t  Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for vagrant-ubuntu-trusty-64
Info: Applying configuration version '1531362495'
Notice: /Stage[main]/Timezone/Debconf[tzdata/Areas]/value: value changed 'Etc' t  o 'UTC'
Notice: /Stage[main]/Timezone/Debconf[tzdata/Zones/UTC]/ensure: created
Notice: /Stage[main]/Timezone/File[/etc/timezone]/content:
--- /etc/timezone       2018-07-12 02:27:41.218332241 +0000
+++ /tmp/puppet-file20180712-3326-xvxp6g        2018-07-12 02:28:16.480387121 +0  000
@@ -1 +1 @@
-Etc/UTC
+UTC

Info: Computing checksum on file /etc/timezone
Info: FileBucket got a duplicate file {md5}4f24b133ba38d8fd565168742c9aedeb
Info: /Stage[main]/Timezone/File[/etc/timezone]: Filebucketed /etc/timezone to p  uppet with sum 4f24b133ba38d8fd565168742c9aedeb
Notice: /Stage[main]/Timezone/File[/etc/timezone]/content:

Notice: /Stage[main]/Timezone/File[/etc/timezone]/content: content changed '{md5  }4f24b133ba38d8fd565168742c9aedeb' to '{md5}ae1d80ba85332ae2d9fbbd491b17c043'
Info: /Stage[main]/Timezone/File[/etc/timezone]: Scheduling refresh of Exec[upda  te_timezone]
Notice: /Stage[main]/Timezone/Exec[update_timezone]: Triggered 'refresh' from 1   events
Notice: Applied catalog in 1.99 seconds
root@vagrant-ubuntu-trusty-64:/home/vagrant#
root@vagrant-ubuntu-trusty-64:/home/vagrant#
root@vagrant-ubuntu-trusty-64:/home/vagrant#
root@vagrant-ubuntu-trusty-64:/home/vagrant#
root@vagrant-ubuntu-trusty-64:/home/vagrant# /opt/puppetlabs/bin/puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for vagrant-ubuntu-trusty-64
Info: Applying configuration version '1531362816'
Notice: /Stage[main]/Timezone/Debconf[tzdata/Areas]/value: value changed 'Etc' to 'UTC'
Notice: /Stage[main]/Timezone/Debconf[tzdata/Zones/UTC]/ensure: created
Notice: /Stage[main]/Timezone/File[/etc/timezone]/content:
--- /etc/timezone       2018-07-12 02:28:16.924312277 +0000
+++ /tmp/puppet-file20180712-3611-1gmd1t8       2018-07-12 02:33:38.571683926 +0000
@@ -1 +1 @@
-Etc/UTC
+UTC

Info: Computing checksum on file /etc/timezone
Info: FileBucket got a duplicate file {md5}4f24b133ba38d8fd565168742c9aedeb
Info: /Stage[main]/Timezone/File[/etc/timezone]: Filebucketed /etc/timezone to puppet with sum 4f24b133ba38d8fd565168742c9aedeb
Notice: /Stage[main]/Timezone/File[/etc/timezone]/content:

Notice: /Stage[main]/Timezone/File[/etc/timezone]/content: content changed '{md5}4f24b133ba38d8fd565168742c9aedeb' to '{md5}ae1d80ba85332ae2d9fbbd491b17c043'
Info: /Stage[main]/Timezone/File[/etc/timezone]: Scheduling refresh of Exec[update_timezone]
Notice: /Stage[main]/Timezone/Exec[update_timezone]: Triggered 'refresh' from 1 events
Notice: Applied catalog in 1.83 seconds

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.