1 # @summary Updates the list of available packages using apt-get update.
8 #TODO: to catch if $::apt_update_last_success has the value of -1 here. If we
9 #opt to do this, a info/warn would likely be all you'd need likely to happen
10 #on the first run, but if it's not run in awhile something is likely borked
11 #with apt and we'd want to know about it.
13 case $::apt::_update['frequency'] {
18 #compare current date with the apt_update_last_success fact to determine
19 #if we should kick apt_update.
20 $daily_threshold = (Integer(Timestamp().strftime('%s')) - 86400)
21 if $::apt_update_last_success {
22 if $::apt_update_last_success + 0 < $daily_threshold {
28 #if apt-get update has not successfully run, we should kick apt_update
33 #compare current date with the apt_update_last_success fact to determine
34 #if we should kick apt_update.
35 $weekly_threshold = (Integer(Timestamp().strftime('%s')) - 604800)
36 if $::apt_update_last_success {
37 if ( $::apt_update_last_success + 0 < $weekly_threshold ) {
43 #if apt-get update has not successfully run, we should kick apt_update
48 #catches 'reluctantly', and any other value (which should not occur).
60 command => "${::apt::provider} update",
61 loglevel => $::apt::_update['loglevel'],
62 logoutput => 'on_failure',
63 refreshonly => $_refresh,
64 timeout => $::apt::_update['timeout'],
65 tries => $::apt::_update['tries'],