diff options
author | Thom May <thom@chef.io> | 2015-10-07 12:06:30 +0100 |
---|---|---|
committer | Thom May <thom@chef.io> | 2015-11-09 15:02:39 +0000 |
commit | 28487132e3d5469c07cbe790fb46edfd555d1c12 (patch) | |
tree | 3a7eb22bf5512d98111880ad63a2f4fcbd28e0b1 /lib/chef/provider/execute.rb | |
parent | c03d49c7cc3b5eb351abc9f6537a1a65692e93fc (diff) | |
download | chef-28487132e3d5469c07cbe790fb46edfd555d1c12.tar.gz |
Implement code review comments and fix failing tests
Diffstat (limited to 'lib/chef/provider/execute.rb')
-rw-r--r-- | lib/chef/provider/execute.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb index 1091b82932..494267828f 100644 --- a/lib/chef/provider/execute.rb +++ b/lib/chef/provider/execute.rb @@ -78,6 +78,14 @@ class Chef !!new_resource.sensitive end + def stream_to_formatter? + Chef::Config[:always_stream_execute] || run_context.events.formatter? + end + + def stream_to_stdout? + STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info? + end + def opts opts = {} opts[:timeout] = timeout @@ -89,10 +97,12 @@ class Chef opts[:umask] = umask if umask opts[:log_level] = :info opts[:log_tag] = new_resource.to_s - 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 + unless sensitive? + if stream_to_formatter? + opts[:live_stream] = Chef::EventDispatch::EventsOutputStream.new(run_context.events, :name => :execute) + elsif stream_to_stdout? + opts[:live_stream] = STDOUT + end end opts end |