diff options
author | John Keiser <jkeiser@opscode.com> | 2013-12-05 14:22:19 -0800 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-12-06 13:50:10 -0800 |
commit | 5e87b84187e8d341fc83bdc90f5a1ce25c871610 (patch) | |
tree | 4d79c77f2b8131db9b3b971b8522e5d4d09b07cb /lib/chef/run_context.rb | |
parent | d85df00ffbedfa440ea529d96a8dc9245fbe44ed (diff) | |
download | chef-5e87b84187e8d341fc83bdc90f5a1ce25c871610.tar.gz |
Add ability to run recipes directly from chef-client command line
Diffstat (limited to 'lib/chef/run_context.rb')
-rw-r--r-- | lib/chef/run_context.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb index 4d431116f9..2ed29a2e34 100644 --- a/lib/chef/run_context.rb +++ b/lib/chef/run_context.rb @@ -152,6 +152,17 @@ class Chef end end + def load_recipe_file(recipe_file) + if !File.exist?(recipe_file) + raise Chef::Exceptions::RecipeNotFound, "could not find recipe file #{recipe_file}" + end + + Chef::Log.debug("Loading Recipe File #{recipe_file}") + recipe = Chef::Recipe.new('@recipe_files', recipe_file, self) + recipe.from_file(recipe_file) + recipe + end + # Looks up an attribute file given the +cookbook_name+ and # +attr_file_name+. Used by DSL::IncludeAttribute def resolve_attribute(cookbook_name, attr_file_name) |