Add the FrozenStrings magic comment
[puppet-modules/puppetlabs-apt.git] / lib / facter / apt_update_last_success.rb
1 # frozen_string_literal: true
2
3 require 'facter'
4
5 # This is derived from the file /var/lib/apt/periodic/update-success-stamp
6 # This is generated upon a successful apt-get update run natively in ubuntu.
7 # the Puppetlabs-apt module deploys this same functionality for other debian-ish OSes
8 Facter.add('apt_update_last_success') do
9   confine osfamily: 'Debian'
10   setcode do
11     if File.exist?('/var/lib/apt/periodic/update-success-stamp')
12       # get epoch time
13       File.mtime('/var/lib/apt/periodic/update-success-stamp').to_i
14     else
15       -1
16     end
17   end
18 end