diff options
| author | Paul Berry <paul@puppetlabs.com> | 2011-01-13 12:18:37 -0800 |
|---|---|---|
| committer | Paul Berry <paul@puppetlabs.com> | 2011-01-13 14:33:03 -0800 |
| commit | 1a6fab2aacbc1499a00a9451654073181435afa1 (patch) | |
| tree | 9615f8b92976fbf90fd55aaa2a077a12237dd830 /lib/puppet | |
| parent | a7cd1856f3347b6a00a260d1001252b56f54f7de (diff) | |
| download | puppet-1a6fab2aacbc1499a00a9451654073181435afa1.tar.gz puppet-1a6fab2aacbc1499a00a9451654073181435afa1.tar.xz puppet-1a6fab2aacbc1499a00a9451654073181435afa1.zip | |
(#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 <nick@puppetlabs.com>
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/application/inspect.rb | 11 | ||||
| -rw-r--r-- | lib/puppet/defaults.rb | 5 |
2 files changed, 16 insertions, 0 deletions
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 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( |
