diff options
author | Luke Kanies <luke@madstop.com> | 2008-04-11 13:01:42 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-04-11 13:01:42 -0500 |
commit | fb05ef3c96038d67a46eb142202af186ad6cb0b3 (patch) | |
tree | 148e8b882e5c8104c4f3fa8ecc4288e8608f812d /lib/puppet/indirector/request.rb | |
parent | b49fb68f768e8b98c555ef0ae08a7bd22f5d36bd (diff) | |
parent | b49fd495622b15f96faf944db1e70cbe9e7fe7c4 (diff) | |
download | puppet-fb05ef3c96038d67a46eb142202af186ad6cb0b3.tar.gz puppet-fb05ef3c96038d67a46eb142202af186ad6cb0b3.tar.xz puppet-fb05ef3c96038d67a46eb142202af186ad6cb0b3.zip |
Merge branch '0.24.x'
Diffstat (limited to 'lib/puppet/indirector/request.rb')
-rw-r--r-- | lib/puppet/indirector/request.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb new file mode 100644 index 000000000..68b7ee160 --- /dev/null +++ b/lib/puppet/indirector/request.rb @@ -0,0 +1,25 @@ +require 'puppet/indirector' + +# Provide any attributes or functionality needed for indirected +# instances. +class Puppet::Indirector::Request + attr_accessor :indirection_name, :key, :method, :options, :instance + + def initialize(indirection_name, method, key, options = {}) + @indirection_name, @method, @options = indirection_name, method, (options || {}) + + if key.is_a?(String) or key.is_a?(Symbol) + @key = key + else + @instance = key + @key = @instance.name + end + + raise ArgumentError, "Request options must be a hash, not %s" % @options.class unless @options.is_a?(Hash) + end + + # Look up the indirection based on the name provided. + def indirection + Puppet::Indirector::Indirection.instance(@indirection_name) + end +end |