summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2015-11-11 09:09:01 +0000
committerThom May <thom@chef.io>2015-11-11 09:09:01 +0000
commit68d75f2d22a4a0f7c39d2eed0de6fb802a82941d (patch)
treec49f3573c20540b992def1f6e5cb923f9dcf92dd
parentdb8cda192518f7d3658573cb7974eb8a6e3dd6d1 (diff)
downloadchef-tm/live_execute_streaming.tar.gz
-rw-r--r--lib/chef/event_dispatch/dispatcher.rb5
-rw-r--r--lib/chef/provider/execute.rb8
2 files changed, 3 insertions, 10 deletions
diff --git a/lib/chef/event_dispatch/dispatcher.rb b/lib/chef/event_dispatch/dispatcher.rb
index 7d7d2c0ad4..ad7df46cd0 100644
--- a/lib/chef/event_dispatch/dispatcher.rb
+++ b/lib/chef/event_dispatch/dispatcher.rb
@@ -22,10 +22,7 @@ class Chef
# Check to see if we are dispatching to a formatter
def formatter?
- @subscribers.each do |s|
- return s.is_formatter? if s.respond_to?(:is_formatter?)
- end
- false
+ @subscribers.any? { |s| s.respond_to?(:is_formatter?) && s.is_formatter? }
end
####
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index 16de268258..200beb02ad 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -79,11 +79,7 @@ class Chef
end
def live_stream?
- !!new_resource.live_stream
- end
-
- def stream_to_formatter?
- Chef::Config[:stream_execute_output] && run_context.events.formatter?
+ Chef::Config[:stream_execute_output] || !!new_resource.live_stream
end
def stream_to_stdout?
@@ -102,7 +98,7 @@ class Chef
opts[:log_level] = :info
opts[:log_tag] = new_resource.to_s
if (Chef::Log.info? || live_stream?) && !sensitive?
- if stream_to_formatter?
+ if run_context.events.formatter?
opts[:live_stream] = Chef::EventDispatch::EventsOutputStream.new(run_context.events, :name => :execute)
elsif stream_to_stdout?
opts[:live_stream] = STDOUT