summaryrefslogtreecommitdiffstats
path: root/lib/puppet/node.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-09-12 15:32:25 -0500
committerLuke Kanies <luke@madstop.com>2007-09-12 15:32:25 -0500
commita6fe70054f4fb3efe4d558ffdd244917ca1c6f9c (patch)
tree6b8dbf7f3f2779254174b0829412a5365ad6ebed /lib/puppet/node.rb
parent1459c507ddccff2a2a6fbadd4c880c023b5e9893 (diff)
downloadpuppet-a6fe70054f4fb3efe4d558ffdd244917ca1c6f9c.tar.gz
puppet-a6fe70054f4fb3efe4d558ffdd244917ca1c6f9c.tar.xz
puppet-a6fe70054f4fb3efe4d558ffdd244917ca1c6f9c.zip
Another intermediate commit. The node and fact classes are now functional and are used instead of the network handlers, which have been removed. There are some failing tests as a result, but I want to get this code committed before I massage the rest of the system to make it work again.
Diffstat (limited to 'lib/puppet/node.rb')
-rw-r--r--lib/puppet/node.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb
index 9c5d2d397..7ad7bc3b3 100644
--- a/lib/puppet/node.rb
+++ b/lib/puppet/node.rb
@@ -1,8 +1,11 @@
+require 'puppet/indirector'
+
# A simplistic class for managing the node information itself.
class Puppet::Node
+ require 'puppet/node/facts'
+
# Set up indirection, so that nodes can be looked for in
# the node sources.
- require 'puppet/indirector'
extend Puppet::Indirector
# Use the node source as the indirection terminus.
@@ -66,9 +69,15 @@ class Puppet::Node
end
# Merge the node facts with parameters from the node source.
- # This is only called if the node source has 'fact_merge' set to true.
- def fact_merge(facts)
- facts.each do |name, value|
+ def fact_merge
+ if facts = Puppet::Node::Facts.get(name)
+ merge(facts.values)
+ end
+ end
+
+ # Merge any random parameters into our parameter list.
+ def merge(params)
+ params.each do |name, value|
@parameters[name] = value unless @parameters.include?(name)
end
end