From: Romain Tartière Date: Fri, 26 Jan 2018 13:32:30 +0000 (+0100) Subject: Fix automatic coercion warning X-Git-Tag: 5.0.0~16^2~1 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=60923a2e88b2df33fd0e80442fd3725ef83a023b;p=puppet-modules%2Fpuppetlabs-apt.git Fix automatic coercion warning Explicitly cast the return value of strftime() to an Integer to avoid spamming the puppet server log file with warning messages: Jan 26 14:19:13 marvin puppet-master[27147]: The string '1516972753' was automatically coerced to the numerical value 1516972753 at /usr/local/etc/puppet/environments/production/modules/apt/manifests/update.pp:17:27 Jan 26 14:19:25 marvin puppet-master[27147]: The string '1516972765' was automatically coerced to the numerical value 1516972765 at /usr/local/etc/puppet/environments/production/modules/apt/manifests/update.pp:17:27 Jan 26 14:19:55 marvin puppet-master[27147]: The string '1516972795' was automatically coerced to the numerical value 1516972795 at /usr/local/etc/puppet/environments/production/modules/apt/manifests/update.pp:17:27 Jan 26 14:20:15 marvin puppet-master[27147]: The string '1516972815' was automatically coerced to the numerical value 1516972815 at /usr/local/etc/puppet/environments/production/modules/apt/manifests/update.pp:17:27 --- diff --git a/manifests/update.pp b/manifests/update.pp index 00e0600..f3871c0 100644 --- a/manifests/update.pp +++ b/manifests/update.pp @@ -14,7 +14,7 @@ class apt::update { 'daily': { #compare current date with the apt_update_last_success fact to determine #if we should kick apt_update. - $daily_threshold = (strftime('%s') - 86400) + $daily_threshold = (Integer(strftime('%s')) - 86400) if $::apt_update_last_success { if $::apt_update_last_success + 0 < $daily_threshold { $_kick_apt = true @@ -29,7 +29,7 @@ class apt::update { 'weekly':{ #compare current date with the apt_update_last_success fact to determine #if we should kick apt_update. - $weekly_threshold = (strftime('%s') - 604800) + $weekly_threshold = (Integer(strftime('%s')) - 604800) if $::apt_update_last_success { if ( $::apt_update_last_success + 0 < $weekly_threshold ) { $_kick_apt = true