From 99b8b93ba1a8510e18413befc8ea7827be080cbd Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Sun, 8 Nov 2009 19:18:56 +0000 Subject: [PATCH] a slightly more careful and tested version Signed-off-by: Stephen Gran --- .../etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb index a20e16ee8..af98ddd66 100644 --- a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb +++ b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb @@ -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 -- 2.20.1