From 1a6fab2aacbc1499a00a9451654073181435afa1 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Thu, 13 Jan 2011 12:18:37 -0800 Subject: (#5171) Made "puppet inspect" upload audited files to a file bucket This only occurs if the new setting :archive_files is set. Another new setting, :archive_file_server, can be used to specify the server that files should be uploaded to. Paired-with: Nick Lewis --- lib/puppet/application/inspect.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb index f2e03b589..b4d263545 100644 --- a/lib/puppet/application/inspect.rb +++ b/lib/puppet/application/inspect.rb @@ -1,5 +1,6 @@ require 'puppet' require 'puppet/application' +require 'puppet/file_bucket/dipper' class Puppet::Application::Inspect < Puppet::Application @@ -55,6 +56,10 @@ class Puppet::Application::Inspect < Puppet::Application inspect_starttime = Time.now @report.add_times("config_retrieval", inspect_starttime - retrieval_starttime) + if Puppet[:archive_files] + dipper = Puppet::FileBucket::Dipper.new(:Server => Puppet[:archive_file_server]) + end + catalog.to_ral.resources.each do |ral_resource| audited_attributes = ral_resource[:audit] next unless audited_attributes @@ -77,6 +82,12 @@ class Puppet::Application::Inspect < Puppet::Application end end @report.add_resource_status(status) + if Puppet[:archive_files] and ral_resource.type == :file and audited_attributes.include?(:content) + path = ral_resource[:path] + if File.readable?(path) + dipper.backup(path) + end + end end finishtime = Time.now -- cgit