Some more fixes. Sigh, some day I'll learn ruby
authorStephen Gran <steve@lobefin.net>
Sat, 14 Nov 2009 19:09:47 +0000 (19:09 +0000)
committerStephen Gran <steve@lobefin.net>
Sat, 14 Nov 2009 19:09:47 +0000 (19:09 +0000)
Signed-off-by: Stephen Gran <steve@lobefin.net>
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"