diff options
-rw-r--r-- | modules/base_installation/lib/facter/ldapvar.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/base_installation/lib/facter/ldapvar.rb b/modules/base_installation/lib/facter/ldapvar.rb index 3ee6623..08d58e4 100644 --- a/modules/base_installation/lib/facter/ldapvar.rb +++ b/modules/base_installation/lib/facter/ldapvar.rb | |||
@@ -27,16 +27,18 @@ begin | |||
27 | 27 | ||
28 | connection.search(base, scope, filter) do |entry| | 28 | connection.search(base, scope, filter) do |entry| |
29 | data_ = entry.to_hash | 29 | data_ = entry.to_hash |
30 | data_['vars'] = (data_[Puppet[:ldapstackedattrs]] || []) | 30 | if data_["objectClass"].any? { |class_| class_ == "puppetClient" } |
31 | .map { |var| var.split("=", 2) } | 31 | data_['vars'] = (data_[Puppet[:ldapstackedattrs]] || []) |
32 | .group_by { |(key, value)| key } | 32 | .map { |var| var.split("=", 2) } |
33 | .map { |key, value| [key, value.map(&:last)] } | 33 | .group_by { |(key, value)| key } |
34 | .to_h | 34 | .map { |key, value| [key, value.map(&:last)] } |
35 | .to_h | ||
35 | 36 | ||
36 | data[:other] << data_ | 37 | data[:other] << data_ |
37 | 38 | ||
38 | if data_["cn"].any? { |cn| cn == host } | 39 | if data_["cn"].any? { |cn| cn == host } |
39 | data[:self] = data_ | 40 | data[:self] = data_ |
41 | end | ||
40 | end | 42 | end |
41 | end | 43 | end |
42 | 44 | ||