diff options
author | Thom May <thom@chef.io> | 2015-11-09 14:59:01 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2015-11-09 15:04:04 +0000 |
commit | db8cda192518f7d3658573cb7974eb8a6e3dd6d1 (patch) | |
tree | 73ee6f11c120e0f15c7c2be1fd311725f9ad40b6 /lib/chef/provider/execute.rb | |
parent | 28487132e3d5469c07cbe790fb46edfd555d1c12 (diff) | |
download | chef-db8cda192518f7d3658573cb7974eb8a6e3dd6d1.tar.gz |
respond to review comments
the logic is now:
if the resource is not sensitive, and if it's explicitly requested to be
streamed or if the log level is info or debug, then we'll consider
streaming it.
If we're configured to send the output to the events stream, we'll do
so.
Otherwise, if we're not daemonized and have a TTY, we'll go to STDOUT
Diffstat (limited to 'lib/chef/provider/execute.rb')
-rw-r--r-- | lib/chef/provider/execute.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb index 494267828f..16de268258 100644 --- a/lib/chef/provider/execute.rb +++ b/lib/chef/provider/execute.rb @@ -78,12 +78,16 @@ class Chef !!new_resource.sensitive end + def live_stream? + !!new_resource.live_stream + end + def stream_to_formatter? - Chef::Config[:always_stream_execute] || run_context.events.formatter? + Chef::Config[:stream_execute_output] && run_context.events.formatter? end def stream_to_stdout? - STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info? + STDOUT.tty? && !Chef::Config[:daemon] end def opts @@ -97,7 +101,7 @@ class Chef opts[:umask] = umask if umask opts[:log_level] = :info opts[:log_tag] = new_resource.to_s - unless sensitive? + if (Chef::Log.info? || live_stream?) && !sensitive? if stream_to_formatter? opts[:live_stream] = Chef::EventDispatch::EventsOutputStream.new(run_context.events, :name => :execute) elsif stream_to_stdout? |