Some more fixes. Sigh, some day I'll learn ruby
[mirror/dsa-puppet.git] / files / etc / puppet / lib / puppet / parser / functions / ldapinfo.rb
index b808090..c65351f 100644 (file)
@@ -7,6 +7,7 @@ module Puppet::Parser::Functions
       attributes << 'hostname'
     end
 
+    require 'ldap'
     ldap = LDAP::SSLConn.new('db.debian.org', 636)
 
     results = {}
@@ -18,7 +19,8 @@ module Puppet::Parser::Functions
         unless attributes.include?("*")
           next if attributes.any?{ |a|  not x[a] or x[a].empty? }
         end
-        results[host] = x
+        results[x['hostname']] = []
+        results[x['hostname']] << x
       end
     rescue LDAP::ResultError
       raise Puppet::ParseError, "LDAP error"