summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-09-23 15:39:07 -0500
committerLuke Kanies <luke@madstop.com>2007-09-23 15:39:07 -0500
commitc40da335123ee839294b37134d1e6361000bf216 (patch)
tree3ba911e9489c68271314b763bd2de8bfd16769fc /lib
parent1e7c648220214eaab253212f1d9dd6bcca9963b7 (diff)
downloadpuppet-c40da335123ee839294b37134d1e6361000bf216.tar.gz
puppet-c40da335123ee839294b37134d1e6361000bf216.tar.xz
puppet-c40da335123ee839294b37134d1e6361000bf216.zip
Adding a "memory" node terminus, which will
be used by 'puppet' and the Cfengine 'module_puppet', since they need to set up the node specially with classes and other weird things.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/indirector/memory.rb21
-rw-r--r--lib/puppet/indirector/memory/node.rb8
2 files changed, 29 insertions, 0 deletions
diff --git a/lib/puppet/indirector/memory.rb b/lib/puppet/indirector/memory.rb
new file mode 100644
index 000000000..5bfcec95d
--- /dev/null
+++ b/lib/puppet/indirector/memory.rb
@@ -0,0 +1,21 @@
+require 'puppet/indirector/terminus'
+
+# Manage a memory-cached list of instances.
+class Puppet::Indirector::Memory < Puppet::Indirector::Terminus
+ def initialize
+ @instances = {}
+ end
+
+ def destroy(instance)
+ raise ArgumentError.new("Could not find %s to destroy" % instance) unless @instances.include?(instance.name)
+ @instances.delete(instance.name)
+ end
+
+ def find(name)
+ @instances[name]
+ end
+
+ def save(instance)
+ @instances[instance.name] = instance
+ end
+end
diff --git a/lib/puppet/indirector/memory/node.rb b/lib/puppet/indirector/memory/node.rb
new file mode 100644
index 000000000..c5000b879
--- /dev/null
+++ b/lib/puppet/indirector/memory/node.rb
@@ -0,0 +1,8 @@
+require 'puppet/indirector/memory'
+
+class Puppet::Indirector::Memory::Node < Puppet::Indirector::Memory
+ desc "Keep track of nodes in memory but nowhere else. This is used for
+ one-time compiles, such as what the stand-alone ``puppet`` does.
+ To use this terminus, you must load it with the data you want it
+ to contain."
+end