diff options
-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 |