1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
--- ldap.rb.orig 2008-04-07 16:34:43.314125000 +0200
+++ ldap.rb 2008-04-07 17:34:18.645503750 +0200
@@ -15,6 +15,11 @@
return nil unless information = super
node = Puppet::Node.new(name)
+ information[:stacked].each do |value|
+ param = value.split('=', 2)
+ information[:parameters][param[0]] = param[1] unless information[:parameters].include?(param[0])
+ end
+
parent_info = nil
parent = information[:parent]
parents = [name]
@@ -30,6 +35,10 @@
raise Puppet::Error.new("Could not find parent node '%s'" % parent)
end
information[:classes] += parent_info[:classes]
+ parent_info[:stacked].each do |value|
+ param = value.split('=', 2)
+ information[:parameters][param[0]] = param[1] unless information[:parameters].include?(param[0])
+ end
parent_info[:parameters].each do |param, value|
# Specifically test for whether it's set, so false values are handled
# correctly.
@@ -55,6 +64,12 @@
end
end
+ # The attributes that Puppet will stack as array over the full
+ # hierarchy.
+ def stacked_attributes
+ Puppet[:ldapstackedattrs].split(/\s*,\s*/)
+ end
+
# Process the found entry. We assume that we don't just want the
# ldap object.
def process(name, entry)
@@ -78,6 +93,14 @@
end
}
+ result[:stacked] = []
+ stacked_attributes.each { |attr|
+ if values = entry.vals(attr)
+ result[:stacked] = result[:stacked] + values
+ end
+ }
+
+
result[:parameters] = entry.to_hash.inject({}) do |hash, ary|
if ary[1].length == 1
hash[ary[0]] = ary[1].shift
|