[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5rc1-120-g2247c80
Nick Lewis
nick at puppetlabs.com
Mon Feb 7 06:40:32 UTC 2011
The following commit has been merged in the upstream branch:
commit 79b633220376bf0503f926b9371283cece17a9e6
Author: Nick Lewis <nick at puppetlabs.com>
Date: Thu Jan 13 16:57:01 2011 -0800
(#5882) Added error-handling for bucketing files in puppet inspect
Paired-With: Paul Berry
diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb
index 5254afb..77e8476 100644
--- a/lib/puppet/application/inspect.rb
+++ b/lib/puppet/application/inspect.rb
@@ -99,7 +99,11 @@ class Puppet::Application::Inspect < Puppet::Application
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)
+ begin
+ dipper.backup(path)
+ rescue StandardError => detail
+ Puppet.warning detail
+ end
end
end
@report.add_resource_status(status)
diff --git a/spec/unit/application/inspect_spec.rb b/spec/unit/application/inspect_spec.rb
index 15b0c40..1d99c6c 100644
--- a/spec/unit/application/inspect_spec.rb
+++ b/spec/unit/application/inspect_spec.rb
@@ -32,7 +32,7 @@ describe Puppet::Application::Inspect do
describe "when executing" do
before :each do
Puppet[:report] = true
- Puppet::Util::Log.stubs(:newdestination)
+ @inspect.options[:logset] = true
Puppet::Transaction::Report::Rest.any_instance.stubs(:save)
@inspect.setup
end
@@ -163,6 +163,20 @@ describe Puppet::Application::Inspect do
Puppet::FileBucketFile::Rest.any_instance.expects(:save).never
@inspect.run_command
end
+
+ it "should continue if bucketing a file fails" do
+ File.open(@file, 'w') { |f| f.write('stuff') }
+ Puppet::FileBucketFile::Rest.any_instance.stubs(:head).returns false
+ Puppet::FileBucketFile::Rest.any_instance.stubs(:save).raises "failure"
+ Puppet::Transaction::Report::Rest.any_instance.expects(:save).with do |request|
+ @report = request.instance
+ end
+
+ @inspect.run_command
+
+ @report.logs.count.should == 1
+ @report.logs.first.message.should =~ /Could not back up/
+ end
end
describe "when auditing non-files" do
@@ -232,7 +246,7 @@ describe Puppet::Application::Inspect do
@inspect.run_command
@report.status.should == "failed"
- #@report.logs.select{|log| log.message =~ /Could not inspect/}.count.should == 1
+ @report.logs.select{|log| log.message =~ /Could not inspect/}.count.should == 1
@report.resource_statuses.count.should == 1
@report.resource_statuses['Stub_type[foo]'].events.count.should == 1
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list