summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector/code
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/indirector/code')
-rw-r--r--lib/puppet/indirector/code/facts.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/puppet/indirector/code/facts.rb b/lib/puppet/indirector/code/facts.rb
new file mode 100644
index 000000000..b64e9854e
--- /dev/null
+++ b/lib/puppet/indirector/code/facts.rb
@@ -0,0 +1,21 @@
+require 'puppet/node/facts'
+require 'puppet/indirector/code'
+
+class Puppet::Indirector::Code::Facts < Puppet::Indirector::Code
+ desc "Retrieve facts from Facter. This provides a somewhat abstract interface
+ between Puppet and Facter. It's only 'somewhat' abstract because it always
+ returns the local host's facts, regardless of what you attempt to find."
+
+ def destroy(facts)
+ raise Puppet::DevError, "You cannot destroy facts in the code store; it is only used for getting facts from Facter"
+ end
+
+ # Look a host's facts up in Facter.
+ def find(key)
+ Puppet::Node::Facts.new(key, Facter.to_hash)
+ end
+
+ def save(facts)
+ raise Puppet::DevError, "You cannot save facts to the code store; it is only used for getting facts from Facter"
+ end
+end