]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
a slightly more careful and tested version
authorStephen Gran <steve@lobefin.net>
Sun, 8 Nov 2009 19:18:56 +0000 (19:18 +0000)
committerStephen Gran <steve@lobefin.net>
Sun, 8 Nov 2009 19:18:56 +0000 (19:18 +0000)
Signed-off-by: Stephen Gran <steve@lobefin.net>
files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb

index a20e16ee89902d01d3489cc1dbafa30a9d5ac6ae..af98ddd66af0705c3a9e00e8780b94510fb9dff6 100644 (file)
@@ -13,7 +13,12 @@ module Puppet::Parser::Functions
       ldap.search2('ou=hosts,dc=debian,dc=org', LDAP::LDAP_SCOPE_SUBTREE, filter, attrs=attributes, false, 0, 0, s_attr="hostname").each do |x|
         # If a returned value doesn't have all the attributes we're searching for, skip
         attributes.each do |a|
-          next if x[a].empty?
+          # We'll skip if the array is empty, but we also seem to get back a nil object for empty attributes sometimes
+          begin
+            next if x[a].empty?
+          rescue NoMethodError
+            next
+          end
         end
         results << x
       end