Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/puppet/generate/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ 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
Puppet::FileSystem::exist?(f) && (Puppet::FileSystem::stat(@path) <=> Puppet::FileSystem::stat(f)) == 0
end

# Gets the filename of the output file.
Expand Down Expand Up @@ -240,6 +240,7 @@ def self.generate(inputs, outputdir = nil, force = false)
Puppet::FileSystem.open(effective_output_path, nil, 'w:UTF-8') do |file|
file.write(result)
end
Puppet::FileSystem.touch(effective_output_path, mtime: Puppet::FileSystem::stat(input.path).mtime)
rescue Exception => e
@bad_input = true
Puppet.log_exception(e, _("Failed to generate '%{effective_output_path}': %{message}") % { effective_output_path: effective_output_path, message: e.message })
Expand Down