Skip to content

Commit

Permalink
Merge pull request #5 from pcarlisle/ticket/2.7.x/12572-last-run-summary
Browse files Browse the repository at this point in the history
(#12572) Don't print a diff of last_run_summary.yaml
  • Loading branch information
slippycheeze committed Feb 22, 2012
2 parents a4dea0f + a8b6088 commit 411828b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
9 changes: 9 additions & 0 deletions acceptance/tests/ticket_12572_no_last_run_summary_diff.rb
@@ -0,0 +1,9 @@
test_name "#12572: Don't print a diff for last_run_summary when show_diff is on"

agents.each do |host|
# Have to run apply twice in order to make sure a diff would be relevant
on host, puppet_apply("--verbose --show_diff"), :stdin => "notice 'hello'"
on host, puppet_apply("--verbose --show_diff"), :stdin => "notice 'hello'" do
assert_no_match(/notice:.*last_run_summary/, stdout, "should not show a diff for last_run_summary")
end
end
16 changes: 5 additions & 11 deletions lib/puppet/configurer.rb
Expand Up @@ -178,17 +178,11 @@ def send_report(report)
end

def save_last_run_summary(report)
last_run = Puppet.settings.setting(:lastrunfile)
last_run.create = true # force file creation

resource = last_run.to_resource
resource[:content] = YAML.dump(report.raw_summary)

catalog = Puppet::Resource::Catalog.new("last_run_file")
catalog.add_resource(resource)
ral = catalog.to_ral
ral.host_config = false
ral.apply
mode = Puppet.settings.setting(:lastrunfile).mode
Puppet::Util::FileLocking.writelock(Puppet[:lastrunfile]) do |file|
file.chmod(mode)
file.print YAML.dump(report.raw_summary)
end
rescue => detail
puts detail.backtrace if Puppet[:trace]
Puppet.err "Could not save last run local report: #{detail}"
Expand Down

0 comments on commit 411828b

Please sign in to comment.