summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominic Cleal <dcleal@redhat.com>2011-02-19 19:00:36 +0000
committerDominic Cleal <dcleal@redhat.com>2011-02-19 19:02:30 +0000
commit7639d5f2de43a117796e91e36f6ac63c4ff05591 (patch)
treee2fee6f46edb45ddc186a354681a394480f6da10
parentf5e21f0796038f8635af0f826eab9d62b494ba49 (diff)
downloadpuppet-7639d5f2de43a117796e91e36f6ac63c4ff05591.tar.gz
puppet-7639d5f2de43a117796e91e36f6ac63c4ff05591.tar.xz
puppet-7639d5f2de43a117796e91e36f6ac63c4ff05591.zip
Fix non-existent method called in SMF manifest import exception message, updated spec
-rwxr-xr-xlib/puppet/provider/service/smf.rb2
-rwxr-xr-xspec/unit/provider/service/smf_spec.rb15
2 files changed, 14 insertions, 3 deletions
diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb
index 042d33980..f6f221a7c 100755
--- a/lib/puppet/provider/service/smf.rb
+++ b/lib/puppet/provider/service/smf.rb
@@ -27,7 +27,7 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
end
end
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error.new( "Cannot config #{self.service} to enable it: #{detail}" )
+ raise Puppet::Error.new( "Cannot config #{self.name} to enable it: #{detail}" )
end
def enable
diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb
index 2f7ecc4aa..40e96ab23 100755
--- a/spec/unit/provider/service/smf_spec.rb
+++ b/spec/unit/provider/service/smf_spec.rb
@@ -99,14 +99,25 @@ describe provider_class do
@provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :clear, "/system/myservice"], true)
@provider.start
end
+ end
- it "should import the manifest if service is not found" do
- @resource[:manifest] = "/tmp/myservice.xml"
+ describe "when starting a service with a manifest" do
+ before(:each) do
+ @resource = Puppet::Type.type(:service).new(:name => "/system/myservice", :ensure => :running, :enable => :true, :manifest => "/tmp/myservice.xml")
+ @provider = provider_class.new(@resource)
$CHILD_STATUS.stubs(:exitstatus).returns(1)
+ end
+
+ it "should import the manifest if service is missing" do
@provider.expects(:svccfg).with(:import, "/tmp/myservice.xml")
@provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :enable, "/system/myservice"], true)
@provider.start
end
+
+ it "should handle failures if importing a manifest" do
+ @provider.expects(:svccfg).raises(Puppet::ExecutionFailure.new("can't svccfg import"))
+ lambda { @provider.start }.should raise_error(Puppet::Error, "Cannot config /system/myservice to enable it: can't svccfg import")
+ end
end
describe "when stopping" do