[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

Luke Kanies luke at madstop.com
Fri Jan 23 14:21:43 UTC 2009


The following commit has been merged in the master branch:
commit b415848841edac9b08ff604416ad2e24dd350b4d
Author: Luke Kanies <luke at madstop.com>
Date:   Mon Nov 24 12:17:52 2008 -0600

    Fixing #1708 - user groups specified as names are now detected correctly.
    
    There was a bug when groups were specified by name -- the group was
    always compared to the current gid, rather than being converted to an
    integer and comparing that way.  This is now fixed.
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb
index 637fe9b..0fe7928 100755
--- a/lib/puppet/type/user.rb
+++ b/lib/puppet/type/user.rb
@@ -98,6 +98,16 @@ module Puppet
                 end
             end
 
+            def insync?(is)
+                # We know the 'is' is a number, so we need to convert the 'should' to a number,
+                # too.
+                @should.each do |value|
+                    return true if number = Puppet::Util.gid(value) and is == number
+                end
+
+                return false
+            end
+
             def sync
                 found = false
                 @should.each do |value|
diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb
index 41b10da..19690ee 100755
--- a/spec/unit/type/user.rb
+++ b/spec/unit/type/user.rb
@@ -161,6 +161,26 @@ describe user do
             gid.should.must == "foo"
         end
 
+        describe "when testing whether in sync" do
+            before do
+                @gid = user.attrclass(:gid).new(:resource => @resource, :should => %w{foo bar})
+            end
+
+            it "should return true if any of the specified groups are equal to the current integer" do
+                Puppet::Util.expects(:gid).with("foo").returns 300
+                Puppet::Util.expects(:gid).with("bar").returns 500
+
+                @gid.must be_insync(500)
+            end
+
+            it "should return false if none of the specified groups are equal to the current integer" do
+                Puppet::Util.expects(:gid).with("foo").returns 300
+                Puppet::Util.expects(:gid).with("bar").returns 500
+
+                @gid.should_not be_insync(700)
+            end
+        end
+
         describe "when syncing" do
             before do
                 @gid = user.attrclass(:gid).new(:resource => @resource, :should => %w{foo bar})

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list