diff options
author | Luke Kanies <luke@madstop.com> | 2009-03-13 18:38:55 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-03-20 18:27:08 +1100 |
commit | 97975e14acfc8c62488a2e6495ca00d426bc9290 (patch) | |
tree | ef745a24c1c43a14f8f404ab2d077e92661509a7 /lib/puppet | |
parent | b6116fe28d9c771dbe2dcded539bcf30eea552a3 (diff) | |
download | puppet-97975e14acfc8c62488a2e6495ca00d426bc9290.tar.gz puppet-97975e14acfc8c62488a2e6495ca00d426bc9290.tar.xz puppet-97975e14acfc8c62488a2e6495ca00d426bc9290.zip |
Adding a model accessor to the Request class
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/indirector/request.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb index 3f7d1c554..5c577a05d 100644 --- a/lib/puppet/indirector/request.rb +++ b/lib/puppet/indirector/request.rb @@ -36,10 +36,6 @@ class Puppet::Indirector::Request URI.escape(key) end - def indirection_name=(name) - @indirection_name = name.to_sym - end - # LAK:NOTE This is a messy interface to the cache, and it's only # used by the Configurer class. I decided it was better to implement # it now and refactor later, when we have a better design, than @@ -91,6 +87,16 @@ class Puppet::Indirector::Request Puppet::Indirector::Indirection.instance(indirection_name) end + def indirection_name=(name) + @indirection_name = name.to_sym + end + + + def model + raise ArgumentError, "Could not find indirection '%s'" % indirection_name unless i = indirection + i.model + end + # Should we allow use of the cached object? def use_cache? if defined?(@use_cache) |