whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] branch master updated: got my & and -'s backwards
Date Thu, 19 May 2016 03:00:06 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  e9eddcc   got my & and -'s backwards
e9eddcc is described below

commit e9eddccd9431d0d86b0ec2ca45f706c3678eff95
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Wed May 18 22:59:21 2016 -0400

    got my & and -'s backwards
    
    protect against empty lists as LDAP doesn't like that
---
 lib/whimsy/asf/ldap.rb | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 1861ef1..267dbcc 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -650,6 +650,7 @@ module ASF
     def remove(people)
       @members = nil
       people = Array(people & members).map(&:dn)
+      return if people.empty?
       mod = ::LDAP::Mod.new(::LDAP::LDAP_MOD_DELETE, 'member', people)
       ASF.ldap.modify(self.dn, [mod])
     ensure
@@ -659,6 +660,7 @@ module ASF
     def add(people)
       @members = nil
       people = Array(people - members).map(&:dn)
+      return if people.empty?
       mod = ::LDAP::Mod.new(::LDAP::LDAP_MOD_ADD, 'member', people)
       ASF.ldap.modify(self.dn, [mod])
     ensure
@@ -705,7 +707,8 @@ module ASF
 
     def remove(people)
       @members = nil
-      people = Array(people - members).map(&:dn)
+      people = Array(people & members).map(&:dn)
+      return if people.empty?
       mod = ::LDAP::Mod.new(::LDAP::LDAP_MOD_DELETE, 'member', people)
       ASF.ldap.modify(self.dn, [mod])
     ensure
@@ -714,7 +717,8 @@ module ASF
 
     def add(people)
       @members = nil
-      people = Array(people & members).map(&:dn)
+      people = Array(people - members).map(&:dn)
+      return if people.empty?
       mod = ::LDAP::Mod.new(::LDAP::LDAP_MOD_ADD, 'member', people)
       ASF.ldap.modify(self.dn, [mod])
     ensure
@@ -749,4 +753,4 @@ if __FILE__ == $0
       puts(puppetonly)
     end
   end
-end
\ No newline at end of file
+end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message