LDAP group membership comparison was happening on an unsorted string. Sorting the string for now, may want to do something smarter by comparing something other than strings later.
Signed-off-by: Matt Robinson <[email protected]> --- lib/puppet/provider/user/ldap.rb | 2 +- spec/unit/provider/user/ldap.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/provider/user/ldap.rb b/lib/puppet/provider/user/ldap.rb index 4ac1803..7c38880 100644 --- a/lib/puppet/provider/user/ldap.rb +++ b/lib/puppet/provider/user/ldap.rb @@ -65,7 +65,7 @@ Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do return @property_hash[:groups] = :absent end - return @property_hash[:groups] = result.collect { |r| r[:name] }.join(",") + return @property_hash[:groups] = result.collect { |r| r[:name] }.sort.join(",") end return @property_hash[:groups] end diff --git a/spec/unit/provider/user/ldap.rb b/spec/unit/provider/user/ldap.rb index a004e20..adc2180 100755 --- a/spec/unit/provider/user/ldap.rb +++ b/spec/unit/provider/user/ldap.rb @@ -143,10 +143,10 @@ describe provider_class do @instance = provider_class.new(:name => "myname") end - it "should show its group membership as the list of all groups returned by an ldap query of group memberships" do + it "should show its group membership as the sorted list of all groups returned by an ldap query of group memberships" do one = {:name => "one"} two = {:name => "two"} - @group_manager.expects(:search).with("memberUid=myname").returns([one, two]) + @group_manager.expects(:search).with("memberUid=myname").returns([two, one]) @instance.groups.should == "one,two" end -- 1.7.1 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
