aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2023-12-26 21:24:57 -0800
committerDan Fandrich <dan@coneharvesters.com>2023-12-26 21:29:17 -0800
commit0780c5695c2cc2d528cef3e72aa33862446a74b2 (patch)
tree4988354a3cc22c0e404605063df83eef4d52d5e1
parent963199d3148da0d05d47a5b9aee93f713961e0aa (diff)
downloadpuppet-0780c5695c2cc2d528cef3e72aa33862446a74b2.tar
puppet-0780c5695c2cc2d528cef3e72aa33862446a74b2.tar.gz
puppet-0780c5695c2cc2d528cef3e72aa33862446a74b2.tar.bz2
puppet-0780c5695c2cc2d528cef3e72aa33862446a74b2.tar.xz
puppet-0780c5695c2cc2d528cef3e72aa33862446a74b2.zip
Fix max_days calculation portability in youri-check
This method should work in the old Puppet 3.6 we're using
-rw-r--r--modules/youri-check/manifests/init.pp4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/youri-check/manifests/init.pp b/modules/youri-check/manifests/init.pp
index 2f8acade..aef33d17 100644
--- a/modules/youri-check/manifests/init.pp
+++ b/modules/youri-check/manifests/init.pp
@@ -31,6 +31,7 @@ class youri-check {
define config($version) {
+ include stdlib
include youri-check::base
$config = "/etc/youri/${version}.conf"
@@ -40,7 +41,8 @@ class youri-check {
$pgsql_user = "youri${version}"
$pgsql_password = extlookup('youri_pgsql','x')
# We want to alert to packages older than last mass rebuild
- $max_days = (Timestamp.now - Timestamp.parse('2022-03-01', '%F')).days
+ # 1646092800 is 2022-03-01 (get it with "TZ=UTC date -d2022-03-01 +%s")
+ $max_days = (time() - 1646092800)/(24*3600)
file { "${config}":
ensure => present,