X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=files%2Fetc%2Fpuppet%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fallnodeinfo.rb;h=47450d559e65f9ab7670febcdef26cf4b25114ed;hb=49d45cfd8f6d14de2d29b1ff1750da69f88d7a14;hp=922f604225b71d89b3f568f10ff853c2e8a10016;hpb=4c7cce3229c0c4ce2701e2e7a018ab2c0ad741c7;p=mirror%2Fdsa-puppet.git diff --git a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb index 922f60422..47450d559 100644 --- a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb +++ b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb @@ -1,28 +1,6 @@ module Puppet::Parser::Functions newfunction(:allnodeinfo, :type => :rvalue) do |attributes| - - unless attributes.include?('hostname') - attributes << 'hostname' - end - - ldap = LDAP::SSLConn.new('db.debian.org', 636) - - results = [] - filter = '(hostname=*)' - 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 - # 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 - raise Puppet::ParseError, "LDAP error" - rescue RuntimeError - raise Puppet::ParseError, "No data returned from search" - ensure - ldap.unbind - end - return(results) + attributes.unshift('*') + return (function_ldapinfo(attributes)) end end