summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2016-09-06 16:21:45 -0700
committerGitHub <noreply@github.com>2016-09-06 16:21:45 -0700
commit9eea32162370b9bf6d0a00f1b4fe7e14850f03d3 (patch)
treeb452efbb31779f28ba67594ae90ff30fe76123e4 /lib
parent977d1e6785ebb69e6b2975072965fe370124af4e (diff)
parent073405c5fd6e73d286da4cce9fdd1c1ffa3e2dcd (diff)
downloadchef-9eea32162370b9bf6d0a00f1b4fe7e14850f03d3.tar.gz
Merge pull request #5281 from coderanger/recipe_file_loaded
Hook up the recipe_file_loaded event which was defined but not actually called
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/event_dispatch/base.rb4
-rw-r--r--lib/chef/formatters/base.rb4
-rw-r--r--lib/chef/run_context/cookbook_compiler.rb5
3 files changed, 7 insertions, 6 deletions
diff --git a/lib/chef/event_dispatch/base.rb b/lib/chef/event_dispatch/base.rb
index 6c6b2fa3bb..04c960c7af 100644
--- a/lib/chef/event_dispatch/base.rb
+++ b/lib/chef/event_dispatch/base.rb
@@ -232,11 +232,11 @@ class Chef
end
# Called after the recipe has been loaded
- def recipe_file_loaded(path)
+ def recipe_file_loaded(path, recipe)
end
# Called after a recipe file fails to load
- def recipe_file_load_failed(path, exception)
+ def recipe_file_load_failed(path, exception, recipe)
end
# Called when a recipe cannot be resolved
diff --git a/lib/chef/formatters/base.rb b/lib/chef/formatters/base.rb
index 3641e619e9..536bf72e02 100644
--- a/lib/chef/formatters/base.rb
+++ b/lib/chef/formatters/base.rb
@@ -203,12 +203,12 @@ class Chef
end
# Delegates to #file_loaded
- def recipe_file_loaded(path)
+ def recipe_file_loaded(path, recipe)
file_loaded(path)
end
# Delegates to #file_load_failed
- def recipe_file_load_failed(path, exception)
+ def recipe_file_load_failed(path, exception, recipe)
file_load_failed(path, exception)
end
diff --git a/lib/chef/run_context/cookbook_compiler.rb b/lib/chef/run_context/cookbook_compiler.rb
index bdf3a1251c..b2a8d236a3 100644
--- a/lib/chef/run_context/cookbook_compiler.rb
+++ b/lib/chef/run_context/cookbook_compiler.rb
@@ -137,13 +137,14 @@ class Chef
@events.recipe_load_start(run_list_expansion.recipes.size)
run_list_expansion.recipes.each do |recipe|
begin
+ path = resolve_recipe(recipe)
@run_context.load_recipe(recipe)
+ @events.recipe_file_loaded(path, recipe)
rescue Chef::Exceptions::RecipeNotFound => e
@events.recipe_not_found(e)
raise
rescue Exception => e
- path = resolve_recipe(recipe)
- @events.recipe_file_load_failed(path, e)
+ @events.recipe_file_load_failed(path, e, recipe)
raise
end
end