[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:06:22 UTC 2009


The following commit has been merged in the upstream branch:
commit 20e5222de71f68780063d774e83fd1debe64ba86
Author: Luke Kanies <luke at madstop.com>
Date:   Mon Oct 26 22:54:38 2009 -0700

    Fixing #2689 - file owner warnings are reduced
    
    We now only warn when there's an actual change to make,
    and we only make one warning per process run.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/type/file/owner.rb b/lib/puppet/type/file/owner.rb
index 1dff59c..e5ca06a 100755
--- a/lib/puppet/type/file/owner.rb
+++ b/lib/puppet/type/file/owner.rb
@@ -28,10 +28,7 @@ module Puppet
         end
 
         def insync?(current)
-            unless Puppet::Util::SUIDManager.uid == 0
-                warning "Cannot manage ownership unless running as root"
-                return true
-            end
+            return true unless should
 
             @should.each do |value|
                 if value =~ /^\d+$/
@@ -44,6 +41,12 @@ module Puppet
 
                 return true if uid == current
             end
+
+            unless Puppet::Util::SUIDManager.uid == 0
+                warnonce "Cannot manage ownership unless running as root"
+                return true
+            end
+
             return false
         end
 
diff --git a/spec/unit/type/file/owner.rb b/spec/unit/type/file/owner.rb
index 1ea01cb..62f7b0a 100755
--- a/spec/unit/type/file/owner.rb
+++ b/spec/unit/type/file/owner.rb
@@ -55,11 +55,13 @@ describe property do
 
     describe "when determining if the file is in sync" do
         describe "and not running as root" do
-            it "should warn and return true" do
-                @owner.should = 10
+            it "should warn once and return true" do
                 Puppet::Util::SUIDManager.expects(:uid).returns 1
-                @owner.expects(:warning)
-                @owner.must be_insync("whatever")
+
+                @owner.expects(:warnonce)
+
+                @owner.should = [10]
+                @owner.must be_insync(20)
             end
         end
 
@@ -67,6 +69,10 @@ describe property do
             Puppet::Util::SUIDManager.stubs(:uid).returns 0
         end
 
+        it "should be in sync if 'should' is not provided" do
+            @owner.must be_insync(10)
+        end
+
         it "should directly compare the owner values if the desired owner is an integer" do
             @owner.should = [10]
             @owner.must be_insync(10)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list