[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Update puppet in stable



Hi,

Back in March, before the previous stable point release update, I had
written to debian-release about an annoying issue that came up with the
puppet package since the release. that was #573551 which has to do with
dependency-based boot scripts and how puppet enables/disables
services. In squeeze, it simply doesn't work correctly with puppet.

The fix that was proposed was flawed, so we backed out of that update
and pushed this around in the puppet team and upstream until a better
fix was found that actually addresses the issue properly. That fix has
been incorporated in the release that has gone through sid->wheezy and
is also in the version in backports, so it has had fairly decent testing
and seems to solve the issue.

So, now it would be good to get that into stable, so please find below
the diff, and if the release team approves, I can upload it to stable:



From 3e25618399f3993046e5170c6081ba33628d318f Mon Sep 17 00:00:00 2001
From: Max Martin <max@puppetlabs.com>
Date: Tue, 22 Mar 2011 16:54:53 -0700
Subject: [PATCH 1/2] (#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
---
 lib/puppet/provider/service/debian.rb     |    8 ++++++--
 spec/unit/provider/service/debian_spec.rb |   16 ++++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb
index 3d09e28..58b808a 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?
diff --git a/spec/unit/provider/service/debian_spec.rb b/spec/unit/provider/service/debian_spec.rb
index 8dee2ee..440d449 100755
--- a/spec/unit/provider/service/debian_spec.rb
+++ b/spec/unit/provider/service/debian_spec.rb
@@ -52,8 +52,20 @@ describe provider_class do
   end
 
   describe "when disabling" do
-    it "should call update-rc.d twice" do
-      @provider.expects(:update_rc).twice
+    it "should be able to disable services with newer sysv-rc versions" do
+      @provider.stubs(:`).with("dpkg --compare-versions $(dpkg-query -W --showformat '${Version}' sysv-rc) ge 2.88 ; echo $?").returns "0"
+
+      @provider.expects(:update_rc).with(@resource[:name], "disable")
+
+      @provider.disable
+    end
+
+    it "should be able to enable services with older sysv-rc versions" do
+      @provider.stubs(:`).with("dpkg --compare-versions $(dpkg-query -W --showformat '${Version}' sysv-rc) ge 2.88 ; echo $?").returns "1"
+
+      @provider.expects(:update_rc).with("-f", @resource[:name], "remove")
+      @provider.expects(:update_rc).with(@resource[:name], "stop", "00", "1", "2", "3", "4", "5", "6", ".")
+
       @provider.disable
     end
   end
-- 
1.7.5.1


From ea3f085953cb981803bfb971cadf286927e7a100 Mon Sep 17 00:00:00 2001
From: Micah Anderson <micah@riseup.net>
Date: Sun, 22 May 2011 15:50:07 -0400
Subject: [PATCH 2/2] update changelog to reflect fix for 573551

---
 debian/changelog |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 56f05f7..fd4aab5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+puppet (2.6.2-5) stable; urgency=low
+
+  [ Micah Anderson ]
+  * Fix puppet service provider to properly use update-rc.d disable API,
+    (Closes: #573551)
+  
+ -- Micah Anderson <micah@debian.org>  Sun, 22 May 2011 15:49:13 -0400
+
 puppet (2.6.2-4) unstable; urgency=low
 
   * Normalize parameterized classes (Closes: #607294)
-- 
1.7.5.1

Attachment: pgpKBp5bTZNu3.pgp
Description: PGP signature


Reply to: