aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-19 16:00:01 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2018-03-19 16:19:17 +0100
commit97103ded8390d10ea3468615c654e89d07c0a921 (patch)
treec748ce388c30aa84cc15290aec65b8d3d9542f5d /modules
parent284fd97e815e9dddf6640fcc4fc5e996687edc8d (diff)
downloadPuppet-97103ded8390d10ea3468615c654e89d07c0a921.tar.gz
Puppet-97103ded8390d10ea3468615c654e89d07c0a921.tar.zst
Puppet-97103ded8390d10ea3468615c654e89d07c0a921.zip
Filter ldapvar to contain only puppetClient information
Diffstat (limited to 'modules')
-rw-r--r--modules/base_installation/lib/facter/ldapvar.rb18
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