From 4c7cce3229c0c4ce2701e2e7a018ab2c0ad741c7 Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Sun, 8 Nov 2009 19:57:21 +0000 Subject: [PATCH] use weaselism: it has the benefit of possibly working Signed-off-by: Stephen Gran --- .../puppet/lib/puppet/parser/functions/allnodeinfo.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb index af98ddd6..922f6042 100644 --- a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb +++ b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb @@ -12,14 +12,8 @@ module Puppet::Parser::Functions begin 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| - # 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 + # We'll skip if the array is empty, but we also seem to get back a nil object for empty attributes sometimes + next if attributes.any?{ |a| not x[a] or x[a].empty? } results << x end rescue LDAP::ResultError -- 2.39.2