[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Dominic Cleal dcleal at redhat.com
Tue May 10 08:05:01 UTC 2011


The following commit has been merged in the experimental branch:
commit 7639d5f2de43a117796e91e36f6ac63c4ff05591
Author: Dominic Cleal <dcleal at redhat.com>
Date:   Sat Feb 19 19:00:36 2011 +0000

    Fix non-existent method called in SMF manifest import exception message, updated spec

diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb
index 042d339..f6f221a 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 2f7ecc4..40e96ab 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

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list