Skip to content

Commit

Permalink
Set default last run times
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamgilbert committed Aug 14, 2024
1 parent 9259885 commit eb9305f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/facter/munki_last_run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
Facter.add(:munki_last_run) do
confine kernel: "Darwin"
setcode do
last_run = "never"
if File.exist?(report_plist)
require "puppet/util/plist" if Puppet.features.cfpropertylist?
plist = Puppet::Util::Plist.read_plist_file(report_plist)
last_run = plist["StartTime"]
last_run
else
"never"
end
last_run
end
end
6 changes: 4 additions & 2 deletions lib/facter/munki_last_run_unix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
Facter.add(:munki_last_run_unix) do
confine kernel: "Darwin"
setcode do
last_run = 0
munki_last_run = Facter.value(:munki_last_run)
if munki_last_run == "never"
0
last_run = 0
else
Time.parse(munki_last_run).to_i
last_run = Time.parse(munki_last_run).to_i
end
last_run
end
end

0 comments on commit eb9305f

Please sign in to comment.