Does Ubuntu 14.04 not support last apt-update check ?

Matt . yamakasi.014 at gmail.com
Mon Jan 23 00:50:12 UTC 2017


Hi,

I'm having an issue with a puppet script where Ubuntu 16.04 can very
simple calculate the last successful apt-get update, 14.04 returns a
-1 and is not capable it seems.

Is this not possible in the apt version of 14.04 ?

On Ubuntu 14.04 $apt_update_last_success defaults to -1 as the same
config works perfectly on Ubuntu 16.04 both with Puppetlabs repo
packages.

Supported Release 2.3.0

'daily': {
#compare current date with the apt_update_last_success fact to determine
#if we should kick apt_update.
$daily_threshold = (strftime('%s') - 86400)
if $::apt_update_last_success {
if $::apt_update_last_success + 0 < $daily_threshold

{ $_kick_apt = true }

else

{ $_kick_apt = false }

} else

{ #if apt-get update has not successfully run, we should kick
apt_update $_kick_apt = true }

}

Ubuntu 14.04

/opt/puppetlabs/puppet/bin/puppet -V
4.8.1

/opt/puppetlabs/puppet/bin/puppet agent -t --debug | grep apt
Debug: Loading facts from /var/lib/puppet/lib/facter/apt_update_last_success.rb
Debug: Loading facts from /var/lib/puppet/lib/facter/apt_updates.rb
Debug: Loading facts from /var/lib/puppet/lib/facter/apt_reboot_required.rb
Info: Facter: loading custom facts from
/var/lib/puppet/lib/facter/apt_update_last_success.rb.
Info: Facter: loading custom facts from
/var/lib/puppet/lib/facter/apt_updates.rb.
Debug: Facter: executing command: /bin/sh -c /usr/bin/apt-get -s upgrade 2>&1
Use 'apt-get autoremove' to remove them.
Info: Facter: loading custom facts from
/var/lib/puppet/lib/facter/apt_reboot_required.rb.
Debug: Facter: fact "apt_has_updates" has resolved to true.
Debug: Facter: fact "apt_package_updates" has resolved to [
Debug: Facter: fact "apt_reboot_required" has resolved to false.
Debug: Facter: fact "apt_security_updates" has resolved to 0.
Debug: Facter: fact "apt_update_last_success" has resolved to -1.
Debug: Facter: fact "apt_updates" has resolved to 15.

Ubuntu 16.04:

/opt/puppetlabs/puppet/bin/puppet -V
4.8.1

/opt/puppetlabs/puppet/bin/puppet agent -t --debug | grep apt
Debug: Loading facts from /var/lib/puppet/lib/facter/apt_reboot_required.rb
Debug: Loading facts from /var/lib/puppet/lib/facter/apt_update_last_success.rb
Debug: Loading facts from /var/lib/puppet/lib/facter/apt_updates.rb
Info: Facter: loading custom facts from
/var/lib/puppet/lib/facter/apt_reboot_required.rb.
Info: Facter: loading custom facts from
/var/lib/puppet/lib/facter/apt_update_last_success.rb.
Info: Facter: loading custom facts from
/var/lib/puppet/lib/facter/apt_updates.rb.
Debug: Facter: executing command: /bin/sh -c /usr/bin/apt-get -s upgrade 2>&1
Debug: Facter: fact "apt_has_updates" has resolved to true.
Debug: Facter: fact "apt_package_updates" has resolved to [
Debug: Facter: fact "apt_reboot_required" has resolved to true.
Debug: Facter: fact "apt_security_updates" has resolved to 0.
Debug: Facter: fact "apt_update_last_success" has resolved to 1484900946.
Debug: Facter: fact "apt_updates" has resolved to 15.

Thanks,

Matt




More information about the ubuntu-users mailing list