Skip to content

Commit f9be67a

Browse files
committed
(PUP-11597) A working, but very likely not ideal fix for PUP-11597
1 parent dfe10b2 commit f9be67a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lib/puppet/generate/type.rb

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,24 @@ def format=(format)
4646
# @return [Boolean] Returns true if the output is up-to-date or false if not.
4747
def up_to_date?(outputdir)
4848
f = effective_output_path(outputdir)
49-
Puppet::FileSystem::exist?(f) && (Puppet::FileSystem::stat(@path) <=> Puppet::FileSystem::stat(f)) <= 0
49+
# Check the fast-path scenarios first.
50+
unless Puppet::FileSystem::exist?(f)
51+
Puppet.debug("#{f} does not exist.")
52+
return false
53+
end
54+
unless (Puppet::FileSystem::stat(@path) <=> Puppet::FileSystem::stat(f)) <= 0
55+
Puppet.debug("#{@path} is newer than #{f}")
56+
return false
57+
end
58+
# Check for updates to any module lib files.
59+
module_lib_files = Dir.glob(@base + "/lib/**/*.rb")
60+
module_lib_files.each do |lib|
61+
unless (Puppet::FileSystem::stat(lib) <=> Puppet::FileSystem::stat(f)) <= 0
62+
Puppet.debug("#{lib} is newer than #{f}")
63+
return false
64+
end
65+
end
66+
return true
5067
end
5168

5269
# Gets the filename of the output file.

0 commit comments

Comments
 (0)