summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorMax Martin <max@puppetlabs.com>2011-03-22 16:54:53 -0700
committerMax Martin <max@puppetlabs.com>2011-03-30 12:56:56 -0700
commitf5aabf52631afbda92dca1b5a90a3198bc4baf99 (patch)
treed61352766a2dca5a6794a2bfae4fa07ba4331c87 /lib/puppet
parent5693e41291593cd69888fdb0536f616c4f5e3d10 (diff)
downloadpuppet-f5aabf52631afbda92dca1b5a90a3198bc4baf99.tar.gz
puppet-f5aabf52631afbda92dca1b5a90a3198bc4baf99.tar.xz
puppet-f5aabf52631afbda92dca1b5a90a3198bc4baf99.zip
(#5908) Add support for new update-rc.d disable API
Added support for the new disable API to update-rc.d and added spec tests to check this functionality. This change was made because in versions of sysv-rc >= 2.88, 'update-rc.d stop' is broken and actually enables the service. We only changed the disable case as the enable case still works on systems which use sysv-rc 2.88 or greater (atm, only Debian Lenny). We wanted to change as little as possible because update-rc.d prints a message stating that the new enable/disable API is unstable and may change in the future. Paired-with:Matt Robinson, Jacob Helwig
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/provider/service/debian.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb
index 3d09e2849..58b808a8e 100755
--- a/lib/puppet/provider/service/debian.rb
+++ b/lib/puppet/provider/service/debian.rb
@@ -22,8 +22,12 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
# Remove the symlinks
def disable
- update_rc "-f", @resource[:name], "remove"
- update_rc @resource[:name], "stop", "00", "1", "2", "3", "4", "5", "6", "."
+ if `dpkg --compare-versions $(dpkg-query -W --showformat '${Version}' sysv-rc) ge 2.88 ; echo $?`.to_i == 0
+ update_rc @resource[:name], "disable"
+ else
+ update_rc "-f", @resource[:name], "remove"
+ update_rc @resource[:name], "stop", "00", "1", "2", "3", "4", "5", "6", "."
+ end
end
def enabled?