[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1456-g2f0b1e5
James Turnbull
james at lovedthanlost.net
Tue Oct 27 17:05:43 UTC 2009
The following commit has been merged in the upstream branch:
commit a951163d3d8a52fff4f0340b4ed1e827f2399147
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date: Wed Sep 16 20:31:25 2009 +0200
Fix #2642 - Runit provider rework
The runit provider was left broken after some work on daemontools
on which runit is based, and #2640 didn't override the
restart command, so daemontools once was called.
This patch aims to fix this provider and bring it on par with
daemontools.
Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>
diff --git a/lib/puppet/provider/service/runit.rb b/lib/puppet/provider/service/runit.rb
index 0182ec7..b313fc7 100644
--- a/lib/puppet/provider/service/runit.rb
+++ b/lib/puppet/provider/service/runit.rb
@@ -66,10 +66,6 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
@servicedir
end
- def restartcmd
- [ command(:sv), "restart", self.service]
- end
-
def status
begin
output = sv "status", self.daemon
@@ -82,23 +78,17 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
return :stopped
end
- # relay to the stopcmd
def stop
- ucommand( :stop )
- end
-
- def stopcmd
- [ command(:sv), "stop", self.service]
+ sv "stop", self.service
end
- # relay to the startcmd
def start
enable unless enabled? == :true
- ucommand( :start )
+ sv "start", self.service
end
- def startcmd
- [ command(:sv), "start", self.service]
+ def restart
+ sv "restart", self.service
end
# disable by removing the symlink so that runit
diff --git a/spec/unit/provider/service/runit.rb b/spec/unit/provider/service/runit.rb
index ad0ad67..dd8d0da 100755
--- a/spec/unit/provider/service/runit.rb
+++ b/spec/unit/provider/service/runit.rb
@@ -35,6 +35,10 @@ describe provider_class do
@provider.stubs(:resource).returns @resource
end
+ it "should have a restart method" do
+ @provider.should respond_to(:restart)
+ end
+
it "should have a restartcmd method" do
@provider.should respond_to(:restartcmd)
end
@@ -62,7 +66,6 @@ describe provider_class do
describe "when starting" do
it "should enable the service if it is not enabled" do
@provider.stubs(:sv)
- @provider.stubs(:ucommand)
@provider.expects(:enabled?).returns :false
@provider.expects(:enable)
@@ -72,18 +75,25 @@ describe provider_class do
it "should execute external command 'sv start /etc/service/myservice'" do
@provider.stubs(:enabled?).returns :true
- @provider.expects(:ucommand).with(:start).returns("")
+ @provider.expects(:sv).with("start", "/etc/service/myservice")
@provider.start
end
end
describe "when stopping" do
it "should execute external command 'sv stop /etc/service/myservice'" do
- @provider.expects(:ucommand).with(:stop).returns("")
+ @provider.expects(:sv).with("stop", "/etc/service/myservice")
@provider.stop
end
end
+ describe "when restarting" do
+ it "should call 'sv restart /etc/service/myservice'" do
+ @provider.expects(:sv).with("restart","/etc/service/myservice")
+ @provider.restart
+ end
+ end
+
describe "when enabling" do
it "should create a symlink between daemon dir and service dir" do
FileTest.stubs(:symlink?).returns(false)
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list