summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2008-07-05 10:20:54 +1000
committerJames Turnbull <james@lovedthanlost.net>2008-07-05 10:20:54 +1000
commit083f4ca7862fbde5cb6fb5562be10f13b66d9250 (patch)
tree72a3a016b8a692dfcdc12b6392059f89a93b2330
parentf4201a2b0a754ab6f276f4bf6e4fe7a976a1721e (diff)
parent196494a63eafc495224c1bfea933740fad7d76f0 (diff)
Merge branch 'tickets/0.24.x/1231' of git://github.com/lak/puppet into 0.24.x
-rw-r--r--CHANGELOG2
-rw-r--r--lib/puppet/util/settings.rb6
-rwxr-xr-xspec/unit/util/settings.rb10
3 files changed, 14 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3ef17882d..1943e3767 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,8 @@
Fixed 1240 - puppet will function more like puppetd if graphing
or reporting are enabled.
+
+ Fixed #1231 - Exceptions during initialization should now be clearer.
Fixed #1006 - puppetrun --class works again. I added the class
membership testing to the Ldap node terminus, and added tests,
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index d8197f743..f20dee401 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -731,8 +731,10 @@ Generated on #{Time.now}.
begin
catalog.host_config = false
catalog.apply do |transaction|
- if failures = transaction.any_failed?
- raise "Could not configure for running; got %s failure(s)" % failures
+ if transaction.any_failed?
+ report = transaction.report
+ failures = report.logs.find_all { |log| log.level == :err }
+ raise "Got %s failure(s) while initializing: %s" % [failures.length, failures.collect { |l| l.to_s }.join("; ")]
end
end
ensure
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb
index de6d6457c..2a3c2afc7 100755
--- a/spec/unit/util/settings.rb
+++ b/spec/unit/util/settings.rb
@@ -696,11 +696,17 @@ describe Puppet::Util::Settings do
@settings.reuse
end
- it "should fail if any resources fail" do
+ it "should fail with an appropriate message if any resources fail" do
stub_transaction
@trans.expects(:any_failed?).returns(true)
+ report = mock 'report'
+ @trans.expects(:report).returns report
- proc { @settings.use(:whatever) }.should raise_error(RuntimeError)
+ log = mock 'log', :to_s => "My failure", :level => :err
+ report.expects(:logs).returns [log]
+
+ @settings.expects(:raise).with { |msg| msg.include?("My failure") }
+ @settings.use(:whatever)
end
after { Puppet::Type.allclear }