summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/application/inspect.rb12
-rw-r--r--lib/puppet/defaults.rb5
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb
index 07ee4c317..b4d263545 100644
--- a/lib/puppet/application/inspect.rb
+++ b/lib/puppet/application/inspect.rb
@@ -1,4 +1,6 @@
+require 'puppet'
require 'puppet/application'
+require 'puppet/file_bucket/dipper'
class Puppet::Application::Inspect < Puppet::Application
@@ -54,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
@@ -76,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
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 4521a5901..400d59f15 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -598,6 +598,11 @@ module Puppet
compression, but if it supports it, this setting might reduce performance on high-speed LANs."]
)
+ setdefaults(:inspect,
+ :archive_files => [false, "During an inspect run, whether to archive files whose contents are audited to a file bucket."],
+ :archive_file_server => ["$server", "During an inspect run, the file bucket server to archive files to if archive_files is set."]
+ )
+
# Plugin information.
setdefaults(