Skip to content

Commit

Permalink
(PUP-11597) A working, but very likely not ideal fix for PUP-11597
Browse files Browse the repository at this point in the history
  • Loading branch information
natemccurdy committed Jul 26, 2022
1 parent dfe10b2 commit f9be67a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/puppet/generate/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,24 @@ def format=(format)
# @return [Boolean] Returns true if the output is up-to-date or false if not.
def up_to_date?(outputdir)
f = effective_output_path(outputdir)
Puppet::FileSystem::exist?(f) && (Puppet::FileSystem::stat(@path) <=> Puppet::FileSystem::stat(f)) <= 0
# Check the fast-path scenarios first.
unless Puppet::FileSystem::exist?(f)
Puppet.debug("#{f} does not exist.")
return false
end
unless (Puppet::FileSystem::stat(@path) <=> Puppet::FileSystem::stat(f)) <= 0
Puppet.debug("#{@path} is newer than #{f}")
return false
end
# Check for updates to any module lib files.
module_lib_files = Dir.glob(@base + "/lib/**/*.rb")
module_lib_files.each do |lib|
unless (Puppet::FileSystem::stat(lib) <=> Puppet::FileSystem::stat(f)) <= 0
Puppet.debug("#{lib} is newer than #{f}")
return false
end
end
return true
end

# Gets the filename of the output file.
Expand Down

0 comments on commit f9be67a

Please sign in to comment.