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=dad7d9bdc1fc85d817bb3c2be7ab53a1cbe2a43e;hp=3eab872d10187862f8d946d19cb6fdebf88eed50;hpb=d33aa87255d079a9744b22ecfec0241a84ba79b0;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 3eab872d1..47450d559 100644 --- a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb +++ b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb @@ -1,29 +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") 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? - end - 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