summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-09-11 16:19:03 -0500
committerLuke Kanies <luke@madstop.com>2007-09-11 16:19:03 -0500
commit65c1501504dd7e9166176661f9ed9f80300954db (patch)
tree9e1bc22b924457561ce0de1b25590effbcd33a4a /lib/puppet/indirector
parent5aa4440b6fb8c9199ee549bd8fe0e4afb296c259 (diff)
downloadpuppet-65c1501504dd7e9166176661f9ed9f80300954db.tar.gz
puppet-65c1501504dd7e9166176661f9ed9f80300954db.tar.xz
puppet-65c1501504dd7e9166176661f9ed9f80300954db.zip
The Node handler is now obsolete. Node searching is handled through the indirector. I have not yet added the tests for the node handlers themselves, which is next.
Diffstat (limited to 'lib/puppet/indirector')
-rw-r--r--lib/puppet/indirector/node/external.rb8
-rw-r--r--lib/puppet/indirector/node/ldap.rb12
-rw-r--r--lib/puppet/indirector/node/none.rb10
3 files changed, 21 insertions, 9 deletions
diff --git a/lib/puppet/indirector/node/external.rb b/lib/puppet/indirector/node/external.rb
index 70fc2505a..ed2a8893e 100644
--- a/lib/puppet/indirector/node/external.rb
+++ b/lib/puppet/indirector/node/external.rb
@@ -1,4 +1,4 @@
-Puppet::Indirector.register_terminus :node, :external, :fact_merge => true do
+Puppet::Indirector.register_terminus :node, :external do
desc "Call an external program to get node information."
include Puppet::Util
@@ -33,7 +33,7 @@ Puppet::Indirector.register_terminus :node, :external, :fact_merge => true do
raise Puppet::Error, "Could not load external node results for %s: %s" % [name, detail]
end
- node = newnode(name)
+ node = Puppe::Node.new(name)
set = false
[:parameters, :classes].each do |param|
if value = result[param]
@@ -42,6 +42,10 @@ Puppet::Indirector.register_terminus :node, :external, :fact_merge => true do
end
end
+ if facts = Puppet::Node.facts(name)
+ node.fact_merge(facts)
+ end
+
if set
return node
else
diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb
index 75a912568..77be04126 100644
--- a/lib/puppet/indirector/node/ldap.rb
+++ b/lib/puppet/indirector/node/ldap.rb
@@ -1,9 +1,9 @@
-Puppet::Indirector.register_terminus :node, :ldap, :fact_merge => true do
+Puppet::Indirector.register_terminus :node, :ldap do
desc "Search in LDAP for node configuration information."
# Look for our node in ldap.
- def get(node)
- unless ary = ldapsearch(node)
+ def get(name)
+ unless ary = ldapsearch(name)
return nil
end
parent, classes, parameters = ary
@@ -18,7 +18,11 @@ Puppet::Indirector.register_terminus :node, :ldap, :fact_merge => true do
end
end
- return newnode(node, :classes => classes, :source => "ldap", :parameters => parameters)
+ node = Puppe::Node.new(name, :classes => classes, :source => "ldap", :parameters => parameters)
+ if facts = Puppet::Node.facts(name)
+ node.fact_merge(facts)
+ end
+ return node
end
# Find the ldap node, return the class list and parent node specially,
diff --git a/lib/puppet/indirector/node/none.rb b/lib/puppet/indirector/node/none.rb
index ce188add5..7143033d9 100644
--- a/lib/puppet/indirector/node/none.rb
+++ b/lib/puppet/indirector/node/none.rb
@@ -1,10 +1,14 @@
-Puppet::Network::Handler::Node.newnode_source(:none, :fact_merge => true) do
+Puppet::Indirector.register_terminus :node, :none do
desc "Always return an empty node object. This is the node source you should
use when you don't have some other, functional source you want to use,
as the compiler will not work without this node information."
# Just return an empty node.
- def nodesearch(name)
- newnode(name)
+ def get(name)
+ node = Puppet::Node.new(name)
+ if facts = Puppet::Node.facts(name)
+ node.fact_merge(facts)
+ end
+ node
end
end