Method: Puppet::Node::Ldap#name2hash

Defined in:
lib/vendor/puppet/indirector/node/ldap.rb

#name2hash(name) ⇒ Object

Separate this out so it’s relatively atomic. It’s tempting to call process instead of name2hash() here, but it ends up being difficult to test because all exceptions get caught by ldapsearch. LAK:NOTE Unfortunately, the ldap support is too stupid to throw anything but LDAP::ResultError, even on bad connections, so we are rough handed with our error handling.



22
23
24
25
26
# File 'lib/vendor/puppet/indirector/node/ldap.rb', line 22

def name2hash(name)
  info = nil
  ldapsearch(search_filter(name)) { |entry| info = entry2hash(entry) }
  info
end