summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorAdam Jacob <adam@opscode.com>2015-01-22 22:17:24 -0800
committerThom May <thom@chef.io>2015-11-09 15:02:39 +0000
commitc03d49c7cc3b5eb351abc9f6537a1a65692e93fc (patch)
tree83c528f4fb89b1c26a45396bf4f0542c180d24de /lib/chef/provider
parentd70014cbcbb99558437587cf03f7b1ec3939df81 (diff)
downloadchef-c03d49c7cc3b5eb351abc9f6537a1a65692e93fc.tar.gz
Implement live streaming for execute resources
This brings live streaming of execute resource output to the output formatters. It also adds a mechanism for checking to see if an output formatter is in use through the event dispatch system. It adds a new configuration option, "always_stream_execute", which does what it says on the tin.
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/execute.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index 30de0d3b9e..1091b82932 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -89,7 +89,9 @@ class Chef
opts[:umask] = umask if umask
opts[:log_level] = :info
opts[:log_tag] = new_resource.to_s
- if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info? && !sensitive?
+ if (Chef::Config[:always_stream_execute] || run_context.events.formatter?) && !sensitive?
+ opts[:live_stream] = Chef::EventDispatch::EventsOutputStream.new(run_context.events, :name => :execute)
+ elsif STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info? && !sensitive?
opts[:live_stream] = STDOUT
end
opts