summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/http/mongrel
diff options
context:
space:
mode:
authorRick Bradley <rick@rickbradley.com>2007-10-16 10:15:14 -0500
committerRick Bradley <rick@rickbradley.com>2007-10-16 10:15:14 -0500
commitc06edda4c94ef9aa685ed44d7031bb39c4a2b0cc (patch)
treec8fedbe14686ac205c212258ac526cd6483982c8 /lib/puppet/network/http/mongrel
parentab4c7fa825e0d1f702adc215c7ff6d445d3b6559 (diff)
downloadpuppet-c06edda4c94ef9aa685ed44d7031bb39c4a2b0cc.tar.gz
puppet-c06edda4c94ef9aa685ed44d7031bb39c4a2b0cc.tar.xz
puppet-c06edda4c94ef9aa685ed44d7031bb39c4a2b0cc.zip
First pass through initializers of {mongrel, webrick} REST handlers; hooks into Indirection to look up models from indirected names.
Diffstat (limited to 'lib/puppet/network/http/mongrel')
-rw-r--r--lib/puppet/network/http/mongrel/rest.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/puppet/network/http/mongrel/rest.rb b/lib/puppet/network/http/mongrel/rest.rb
index 6e454c7d9..34f1d8f90 100644
--- a/lib/puppet/network/http/mongrel/rest.rb
+++ b/lib/puppet/network/http/mongrel/rest.rb
@@ -1,4 +1,18 @@
class Puppet::Network::HTTP::MongrelREST
def initialize(args = {})
+ raise ArgumentError unless args[:server]
+ raise ArgumentError if !args[:handlers] or args[:handlers].empty?
+
+ @models = {}
+ args[:handlers].each do |handler|
+ @models[handler] = find_model_for_handler(handler)
+ end
+ end
+
+ private
+
+ def find_model_for_handler(handler)
+ Puppet::Indirector::Indirection.model(handler) ||
+ raise(ArgumentError, "Cannot locate indirection [#{handler}].")
end
end