summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-12-09 10:32:41 -0800
committerJohn Keiser <john@johnkeiser.com>2015-12-09 10:32:41 -0800
commit9137259edfb8496ec8f2a354be788215a2cd1085 (patch)
tree232bbdc8b14793618e7b724697cafec3fc96634a
parent9b0a4fd24e9939f95082f0fb7739f298a5791432 (diff)
downloadchef-9137259edfb8496ec8f2a354be788215a2cd1085.tar.gz
Work with cheffish (which has no before_notifications)
-rw-r--r--lib/chef/runner.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/chef/runner.rb b/lib/chef/runner.rb
index e1b4e98f89..61b68e2375 100644
--- a/lib/chef/runner.rb
+++ b/lib/chef/runner.rb
@@ -49,7 +49,9 @@ class Chef
# If there are any before notifications, why-run the resource
# and notify anyone who needs notifying
- if !run_context.before_notifications(resource).empty?
+ # TODO cheffish has a bug where it passes itself instead of the run_context to us, so doesn't have before_notifications. Fix there, update dependency requirement, and remove this if statement.
+ before_notifications = run_context.before_notifications(resource) if run_context.respond_to?(:before_notifications)
+ if before_notifications && !before_notifications.empty?
whyrun_before = Chef::Config[:why_run]
begin
Chef::Config[:why_run] = true
@@ -60,7 +62,7 @@ class Chef
end
if resource.updated_by_last_action?
- run_context.before_notifications(resource).each do |notification|
+ before_notifications.each do |notification|
Chef::Log.info("#{resource} sending #{notification.action} action to #{notification.resource} (before)")
run_action(notification.resource, notification.action, :before, resource)
end