From 57c7bf84ca02a8bd5a10dd6e8e12689ee5a97812 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Sun, 6 Dec 2015 15:27:55 -0800 Subject: Fix resource `super` (broken because of test :focus) --- lib/chef/provider.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1