diff options
author | John Keiser <john@johnkeiser.com> | 2015-12-06 15:27:55 -0800 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-12-06 15:27:55 -0800 |
commit | 57c7bf84ca02a8bd5a10dd6e8e12689ee5a97812 (patch) | |
tree | d9d5403a39506cb03f0d24a926c144f6de530b8f /lib/chef | |
parent | 691d0b8c14816316a814823c6113b74e89360662 (diff) | |
download | chef-57c7bf84ca02a8bd5a10dd6e8e12689ee5a97812.tar.gz |
Fix resource `super` (broken because of test :focus)jk/fix-resource-super
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/provider.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index 3ddf33844f..68bc8d78bd 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -376,7 +376,18 @@ class Chef # compile the resources, converging them, and then checking if any # were updated (and updating new-resource if so) def action(name, &block) - define_method("action_#{name}") { compile_and_converge_action(&block) } + # We need the block directly in a method so that `super` works + define_method("compile_action_#{name}", &block) + # We try hard to use `def` because define_method doesn't show the method name in the stack. + begin + class_eval <<-EOM + def action_#{name} + compile_and_converge_action { compile_action_#{name} } + end + EOM + rescue SyntaxError + define_method("action_#{name}") { send("compile_action_#{name}") } + end end end |