You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sebastian Bazley <se...@apache.org> on 2016/02/05 23:17:29 UTC

[whimsy.git] [1/1] Commit a954add: init_ldap check is not useful.

Commit a954add45831fb9bbe3b60084865be1dd59b2d2d:
    init_ldap check is not useful.
    The query may still fail to produce results, so check them


Branch: refs/heads/master
Author: Sebb <se...@apache.org>
Committer: Sebb <se...@apache.org>
Pusher: sebb <se...@apache.org>

------------------------------------------------------------
www/roster/public_ldap_committees.rb                         | +++++ ---
www/roster/public_ldap_groups.rb                             | +++++ ---
www/roster/public_ldap_people.rb                             | +++++ ---
www/roster/public_ldap_services.rb                           | +++++ ---
------------------------------------------------------------
32 changes: 20 additions, 12 deletions.
------------------------------------------------------------


diff --git a/www/roster/public_ldap_committees.rb b/www/roster/public_ldap_committees.rb
index 7fa06a7..ef77d77 100644
--- a/www/roster/public_ldap_committees.rb
+++ b/www/roster/public_ldap_committees.rb
@@ -20,14 +20,16 @@
 
 require 'whimsy/asf'
 
-ldap = ASF.init_ldap
-exit 1 unless ldap
-
 # gather committee info
 entries = {}
 
 committees = ASF::Committee.preload # for performance
 
+if committees.empty?
+  Wunderbar.error "No results retrieved, output not created"
+  exit 0
+end
+
 lastStamp = ''
 committees.keys.sort_by {|a| a.name}.each do |entry|
     m = []
diff --git a/www/roster/public_ldap_groups.rb b/www/roster/public_ldap_groups.rb
index c4ca278..ecb97c8 100644
--- a/www/roster/public_ldap_groups.rb
+++ b/www/roster/public_ldap_groups.rb
@@ -20,14 +20,16 @@
 
 require 'whimsy/asf'
 
-ldap = ASF.init_ldap
-exit 1 unless ldap
-
 # gather unix group info
 entries = {}
 
 groups = ASF::Group.preload # for performance
 
+if groups.empty?
+  Wunderbar.error "No results retrieved, output not created"
+  exit 0
+end
+
 lastStamp = ''
 groups.keys.sort_by {|a| a.name}.each do |entry|
     m = []
diff --git a/www/roster/public_ldap_people.rb b/www/roster/public_ldap_people.rb
index 5636b7e..1c0312f 100644
--- a/www/roster/public_ldap_people.rb
+++ b/www/roster/public_ldap_people.rb
@@ -16,14 +16,16 @@
 
 require 'whimsy/asf'
 
-ldap = ASF.init_ldap
-exit 1 unless ldap
-
 # ASF people
 peo = {}
 
 peeps = ASF::Person.preload(['cn', 'loginShell']) # for performance
 
+if peeps.empty?
+  Wunderbar.error "No results retrieved, output not created"
+  exit 0
+end
+
 # Make output smaller by ommitting commonest case (noLogin: false)
 def makeEntry(hash, e)
   if e.banned?
diff --git a/www/roster/public_ldap_services.rb b/www/roster/public_ldap_services.rb
index edf12c4..4ad8503 100644
--- a/www/roster/public_ldap_services.rb
+++ b/www/roster/public_ldap_services.rb
@@ -20,14 +20,16 @@
 
 require 'whimsy/asf'
 
-ldap = ASF.init_ldap
-exit 1 unless ldap
-
 # gather unix group info
 entries = {}
 
 groups = ASF::Service.preload # for performance
 
+if groups.empty?
+  Wunderbar.error "No results retrieved, output not created"
+  exit 0
+end
+
 lastStamp = ''
 groups.keys.sort_by {|a| a.name}.each do |entry|
     m = []