diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-10-07 21:51:14 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-10-07 21:51:14 -0700 |
commit | 3de048df843c640f1a9c5d1879504e9675fb2cfe (patch) | |
tree | 2671f505d2fd6a06e5ba6fe46e0d2109fcc9c02c | |
parent | 1343bdfff0d54e20b923211f6697d42c484c1627 (diff) | |
download | chef-lcg/definition-retval.tar.gz |
return whatever the definition returnslcg/definition-retval
this can allow method chaining so that if you call a definition to
create a resource, and the definition takes the time to return the
resource as its retval, then you can hang a .not_if off of the
definition (or .only_if/.notifies/.subscribes/etc)
-rw-r--r-- | lib/chef/dsl/recipe.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb index 3282320b8c..d88c0a4569 100644 --- a/lib/chef/dsl/recipe.rb +++ b/lib/chef/dsl/recipe.rb @@ -52,9 +52,7 @@ class Chef end def has_resource_definition?(name) - yes_or_no = run_context.definitions.has_key?(name) - - yes_or_no + run_context.definitions.has_key?(name) end # Processes the arguments and block as a resource definition. @@ -68,12 +66,10 @@ class Chef # This sets up the parameter overrides new_def.instance_eval(&block) if block - new_recipe = Chef::Recipe.new(cookbook_name, recipe_name, run_context) new_recipe.params = new_def.params new_recipe.params[:name] = args[0] new_recipe.instance_eval(&new_def.recipe) - new_recipe end # Instantiates a resource (via #build_resource), then adds it to the |