diff options
author | Tim Smith <tsmith@chef.io> | 2019-05-30 11:09:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-30 11:09:13 -0700 |
commit | 6a5c6c3426b3fb144ab305072a9353214214850f (patch) | |
tree | ecd802bc8beaf891fad824886c4d14e9692b67e2 | |
parent | abc4b4ffdc19b4fb25eb7c7b84acd9ce3e78b420 (diff) | |
parent | f4e477bd72b4ce41e8db6fb5428d0c7c662dc8f9 (diff) | |
download | chef-6a5c6c3426b3fb144ab305072a9353214214850f.tar.gz |
Merge pull request #8621 from chef/btm/14-knife-fixes
14: backport knife fixes
-rw-r--r-- | lib/chef/knife.rb | 2 | ||||
-rw-r--r-- | lib/chef/knife/bootstrap.rb | 2 | ||||
-rw-r--r-- | spec/unit/knife_spec.rb | 13 |
3 files changed, 10 insertions, 7 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index 6051f9fd66..f645b85712 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -446,7 +446,7 @@ class Chef run end rescue Exception => e - raise if raise_exception || Chef::Config[:verbosity] == 2 + raise if raise_exception || ( Chef::Config[:verbosity] && Chef::Config[:verbosity] >= 2 ) humanize_exception(e) exit 100 end diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 8b6344cecd..5f2a0df00a 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -330,7 +330,7 @@ class Chef raise Errno::ENOENT end - Chef::Log.trace("Found bootstrap template in #{File.dirname(template_file)}") + Chef::Log.trace("Found bootstrap template: #{template_file}") template_file end diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb index 67251b2cd9..fceb00aa09 100644 --- a/spec/unit/knife_spec.rb +++ b/spec/unit/knife_spec.rb @@ -344,11 +344,14 @@ describe Chef::Knife do end end - it "does not humanize the exception if Chef::Config[:verbosity] is two" do - Chef::Config[:verbosity] = 2 - allow(knife).to receive(:run).and_raise(Exception) - expect(knife).not_to receive(:humanize_exception) - expect { knife.run_with_pretty_exceptions }.to raise_error(Exception) + # -VV (2) is debug, -VVV (3) is trace + [ 2, 3 ].each do |verbosity| + it "does not humanize the exception if Chef::Config[:verbosity] is #{verbosity}" do + Chef::Config[:verbosity] = verbosity + allow(knife).to receive(:run).and_raise(Exception) + expect(knife).not_to receive(:humanize_exception) + expect { knife.run_with_pretty_exceptions }.to raise_error(Exception) + end end end |