summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-02 22:03:45 -0500
committerLuke Kanies <luke@madstop.com>2008-07-02 22:03:45 -0500
commitc825c991fd68274ae1b172f97059be616d5b057e (patch)
treecfa8e7e6bff3c0c85ce0340b344f8d6ffde912bc /lib
parentdaf0d9db5dc400a9795a5f741c8c63184f5e8982 (diff)
downloadpuppet-c825c991fd68274ae1b172f97059be616d5b057e.tar.gz
puppet-c825c991fd68274ae1b172f97059be616d5b057e.tar.xz
puppet-c825c991fd68274ae1b172f97059be616d5b057e.zip
Fixing the ldap node terminus to merge facts with the right name.
Previously, I was merging early and changing the name later. This commit fixes it so that the node is created with the right name in the first place, so the node.fact_merge actually works. Yay for real-world testing. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/indirector/node/ldap.rb15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb
index 71d3e3b0e..01010a2af 100644
--- a/lib/puppet/indirector/node/ldap.rb
+++ b/lib/puppet/indirector/node/ldap.rb
@@ -14,7 +14,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
end
# Separate this out so it's relatively atomic. It's tempting to call
- # process() instead of entry2hash() here, but it ends up being
+ # 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
@@ -35,21 +35,14 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
node = nil
names.each do |name|
- break if node = process(name)
- end
- return nil unless node
+ next unless info = name2hash(name)
- node.name = request.key
+ break if node = info2node(request.key, info)
+ end
return node
end
- def process(name)
- return nil unless info = name2hash(name)
-
- info2node(name, info)
- end
-
# Find more than one node. LAK:NOTE This is a bit of a clumsy API, because the 'search'
# method currently *requires* a key. It seems appropriate in some cases but not others,
# and I don't really know how to get rid of it as a requirement but allow it when desired.