summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-28 20:43:22 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-28 20:43:22 +0000
commit1f41c35c6c081c2f673d713588220e78d8c7c1b0 (patch)
tree12a2d606f5202ec687c999280fd94cefd4368d87
parentc07494ff770d7e6432fed4e48e36f5b801b05f8d (diff)
downloadpuppet-1f41c35c6c081c2f673d713588220e78d8c7c1b0.tar.gz
puppet-1f41c35c6c081c2f673d713588220e78d8c7c1b0.tar.xz
puppet-1f41c35c6c081c2f673d713588220e78d8c7c1b0.zip
Fixing #454.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2105 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xlib/puppet/provider/service/base.rb2
-rwxr-xr-xtest/providers/service/base.rb23
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/puppet/provider/service/base.rb b/lib/puppet/provider/service/base.rb
index 9099fc730..c615c30c0 100755
--- a/lib/puppet/provider/service/base.rb
+++ b/lib/puppet/provider/service/base.rb
@@ -116,7 +116,7 @@ Puppet::Type.type(:service).provide :base do
begin
output = execute(command, fof)
rescue Puppet::ExecutionFailure => detail
- warning "Could not %s %s: %s" % [type, @model.ref, detail]
+ @model.fail "Could not %s %s: %s" % [type, @model.ref, detail]
end
return output
diff --git a/test/providers/service/base.rb b/test/providers/service/base.rb
index 0de6c806b..38f2df5e6 100755
--- a/test/providers/service/base.rb
+++ b/test/providers/service/base.rb
@@ -47,6 +47,29 @@ class TestBaseServiceProvider < Test::Unit::TestCase
assert_equal(:stopped, provider.status, "status was not returned correctly")
end
end
+
+ # Testing #454
+ def test_that_failures_propagate
+ nope = "/no/such/command"
+ service = Puppet::Type.type(:service).create(
+ :name => "yaytest", :provider => :base,
+ :start => nope,
+ :status => nope,
+ :stop => nope,
+ :restart => nope
+ )
+
+ provider = service.provider
+ assert(provider, "did not get base provider")
+
+ # We can't fail well when status is messed up, because we depend on the return code
+ # of the command for data.
+ %w{start stop restart}.each do |command|
+ assert_raise(Puppet::Error, "did not throw error when %s failed" % command) do
+ provider.send(command)
+ end
+ end
+ end
end
# $Id$ \ No newline at end of file