summaryrefslogtreecommitdiffstats
path: root/lib/puppet/node/facts.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-09-11 12:38:56 -0500
committerLuke Kanies <luke@madstop.com>2007-09-11 12:38:56 -0500
commit5aa4440b6fb8c9199ee549bd8fe0e4afb296c259 (patch)
tree4b502958da9929e6290993a7bc65e8b8fdc29dd9 /lib/puppet/node/facts.rb
parentbb69a1f08a6b0ba37222eeddf28ffbff657283e7 (diff)
downloadpuppet-5aa4440b6fb8c9199ee549bd8fe0e4afb296c259.tar.gz
puppet-5aa4440b6fb8c9199ee549bd8fe0e4afb296c259.tar.xz
puppet-5aa4440b6fb8c9199ee549bd8fe0e4afb296c259.zip
Doing an intermediate commit so rick can look at the work I have done so far.
Diffstat (limited to 'lib/puppet/node/facts.rb')
-rwxr-xr-xlib/puppet/node/facts.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb
new file mode 100755
index 000000000..eddf44def
--- /dev/null
+++ b/lib/puppet/node/facts.rb
@@ -0,0 +1,36 @@
+# Manage a given node's facts. This either accepts facts and stores them, or
+# returns facts for a given node.
+class 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.
+ indirects :facts, :to => :fact_store
+
+ attr_accessor :name, :values
+
+ def initialize(name, values = {})
+ @name = name
+ @values = values
+ end
+
+ private
+
+ # FIXME These methods are currently unused.
+
+ # Add internal data to the facts for storage.
+ def add_internal(facts)
+ facts = facts.dup
+ facts[:_puppet_timestamp] = Time.now
+ facts
+ end
+
+ # Strip out that internal data.
+ def strip_internal(facts)
+ facts = facts.dup
+ facts.find_all { |name, value| name.to_s =~ /^_puppet_/ }.each { |name, value| facts.delete(name) }
+ facts
+ end
+end