diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-19 16:21:45 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-03-19 16:21:45 +0100 |
commit | f4c9ed4c0a32082d8f7b60cee1eb33cb05c85a1c (patch) | |
tree | c748ce388c30aa84cc15290aec65b8d3d9542f5d /modules/base_installation/lib/facter/ldapvar.rb | |
parent | 433e9279d165bf225c597834b5a7c7ae64c11a27 (diff) | |
parent | 97103ded8390d10ea3468615c654e89d07c0a921 (diff) | |
download | Puppet-f4c9ed4c0a32082d8f7b60cee1eb33cb05c85a1c.tar.gz Puppet-f4c9ed4c0a32082d8f7b60cee1eb33cb05c85a1c.tar.zst Puppet-f4c9ed4c0a32082d8f7b60cee1eb33cb05c85a1c.zip |
Merge branch 'ldap_lookup' into dev
Diffstat (limited to 'modules/base_installation/lib/facter/ldapvar.rb')
-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 | ||