summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-18 17:29:21 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-19 10:53:49 -0700
commit0fed94fbbad45388c1f9d2451d946681d80643f8 (patch)
tree7d583ad4aa0e2709c5deddfcefafae1e67283ca9 /lib/puppet/interface
parent12098f2d54e8e00a687f42837deeef65c7759389 (diff)
downloadpuppet-0fed94fbbad45388c1f9d2451d946681d80643f8.tar.gz
puppet-0fed94fbbad45388c1f9d2451d946681d80643f8.tar.xz
puppet-0fed94fbbad45388c1f9d2451d946681d80643f8.zip
(#7013) Wire up rendering hooks on the CLI.
We now find, and call, the appropriate rendering hooks on actions during the rendering phase. This allows the user to intercept and replace the result object that passes through the rest of the rendering system on the fly. Example usage: action :foo do when_rendering :pson do |result| { :whatever => result[a], :foobar => result[b], } end end Reviewed-By: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'lib/puppet/interface')
-rw-r--r--lib/puppet/interface/action.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb
index d9ba4eb60..b43895067 100644
--- a/lib/puppet/interface/action.rb
+++ b/lib/puppet/interface/action.rb
@@ -39,7 +39,8 @@ class Puppet::Interface::Action
unless type.is_a? Symbol
raise ArgumentError, "The rendering format must be a symbol, not #{type.class.name}"
end
- @when_rendering[type].bind(@face)
+ return unless @when_rendering.has_key? type
+ return @when_rendering[type].bind(@face)
end
def set_rendering_method_for(type, proc)
unless proc.is_a? Proc