Skip to content

Commit eb9305f

Browse files
committed
Set default last run times
1 parent 9259885 commit eb9305f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/facter/munki_last_run.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
Facter.add(:munki_last_run) do
77
confine kernel: "Darwin"
88
setcode do
9+
last_run = "never"
910
if File.exist?(report_plist)
1011
require "puppet/util/plist" if Puppet.features.cfpropertylist?
1112
plist = Puppet::Util::Plist.read_plist_file(report_plist)
1213
last_run = plist["StartTime"]
13-
last_run
14-
else
15-
"never"
1614
end
15+
last_run
1716
end
1817
end

lib/facter/munki_last_run_unix.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
Facter.add(:munki_last_run_unix) do
66
confine kernel: "Darwin"
77
setcode do
8+
last_run = 0
89
munki_last_run = Facter.value(:munki_last_run)
910
if munki_last_run == "never"
10-
0
11+
last_run = 0
1112
else
12-
Time.parse(munki_last_run).to_i
13+
last_run = Time.parse(munki_last_run).to_i
1314
end
15+
last_run
1416
end
1517
end

0 commit comments

Comments
 (0)