Ticket #1179: stack_ldap.patch
| File stack_ldap.patch, 1.8 kB (added by wrobel, 9 months ago) |
|---|
-
ldap.rb
old new 15 15 return nil unless information = super 16 16 node = Puppet::Node.new(name) 17 17 18 information[:stacked].each do |value| 19 param = value.split('=', 2) 20 information[:parameters][param[0]] = param[1] unless information[:parameters].include?(param[0]) 21 end 22 18 23 parent_info = nil 19 24 parent = information[:parent] 20 25 parents = [name] … … 30 35 raise Puppet::Error.new("Could not find parent node '%s'" % parent) 31 36 end 32 37 information[:classes] += parent_info[:classes] 38 parent_info[:stacked].each do |value| 39 param = value.split('=', 2) 40 information[:parameters][param[0]] = param[1] unless information[:parameters].include?(param[0]) 41 end 33 42 parent_info[:parameters].each do |param, value| 34 43 # Specifically test for whether it's set, so false values are handled 35 44 # correctly. … … 55 64 end 56 65 end 57 66 67 # The attributes that Puppet will stack as array over the full 68 # hierarchy. 69 def stacked_attributes 70 Puppet[:ldapstackedattrs].split(/\s*,\s*/) 71 end 72 58 73 # Process the found entry. We assume that we don't just want the 59 74 # ldap object. 60 75 def process(name, entry) … … 78 93 end 79 94 } 80 95 96 result[:stacked] = [] 97 stacked_attributes.each { |attr| 98 if values = entry.vals(attr) 99 result[:stacked] = result[:stacked] + values 100 end 101 } 102 103 81 104 result[:parameters] = entry.to_hash.inject({}) do |hash, ary| 82 105 if ary[1].length == 1 83 106 hash[ary[0]] = ary[1].shift