2 #TODO: to catch if $::apt_update_last_success has the value of -1 here. If we
3 #opt to do this, a info/warn would likely be all you'd need likely to happen
4 #on the first run, but if it's not run in awhile something is likely borked
5 #with apt and we'd want to know about it.
7 if $::apt::always_apt_update == false {
8 #if always_apt_update is true there's no point in parsing this logic.
10 case $apt::apt_update_frequency {
15 #compare current date with the apt_update_last_success fact to determine
16 #if we should kick apt_update.
17 $daily_threshold = (strftime('%s') - 86400)
18 if $::apt_update_last_success {
19 if $::apt_update_last_success < $daily_threshold {
25 #if apt-get update has not successfully run, we should kick apt_update
30 #compare current date with the apt_update_last_success fact to determine
31 #if we should kick apt_update.
32 $weekly_threshold = (strftime('%s') - 604800)
33 if $::apt_update_last_success {
34 if ( $::apt_update_last_success < $weekly_threshold ) {
40 #if apt-get update has not successfully run, we should kick apt_update
45 #catches 'recluctantly', and any other value (which should not occur).
60 command => "${apt::params::provider} update",
61 logoutput => 'on_failure',
62 refreshonly => $_refresh,
63 timeout => $apt::update_timeout,
64 tries => $apt::update_tries,