Skip to content

Commit

Permalink
Fix automatic coercion warning
Browse files Browse the repository at this point in the history
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 <daemon.warn> 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 <daemon.warn> 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 <daemon.warn> 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 <daemon.warn> 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
  • Loading branch information
smortex committed Jan 26, 2018
1 parent 2df93f9 commit 60923a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions manifests/update.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'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
Expand All @@ -29,7 +29,7 @@
'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
Expand Down

0 comments on commit 60923a2

Please sign in to comment.