diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-21 14:51:46 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-21 14:51:46 -0700 |
commit | d23db7c88801551ef92af553764d0a38cc5d75f5 (patch) | |
tree | 64c147b77dd5c9edcacd94715c5da7061bacc1d1 /lib/chef/provider.rb | |
parent | 3099264e4e44c4615622f1d69fc040a5d4d90500 (diff) | |
download | chef-d23db7c88801551ef92af553764d0a38cc5d75f5.tar.gz |
Chef-13: Simplify DSL creation
we did actually have tests around creating actions with spaces and
hyphens in their names. we had fallback code for properties, but it
was broken and threw a "private method define_resource called" and then
it created a closure and didn't have the `name` in the binding so it
called itself and blew up the stack.
this change walks that back. it does prove that we still support
UTF-8 in property names, actions and DSL names, which i'd argue is
more than enough.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/provider.rb')
-rw-r--r-- | lib/chef/provider.rb | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index 0ec441202c..bdc1114f0d 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -379,16 +379,11 @@ class Chef def action(name, &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 + class_eval <<-EOM + def action_#{name} + compile_and_converge_action { compile_action_#{name} } + end + EOM end end end |