diff options
author | jkeiser <jkeiser@opscode.com> | 2013-01-21 12:31:09 -0800 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:25 -0700 |
commit | 20b8bc310e9df2a557cc210abe4f2cae13b10b5c (patch) | |
tree | fcb77d08e9b500067d53d0f2ba75a7abb11f6cf7 /lib/chef/knife/diff.rb | |
parent | 8fa8fb0af3aad065b1959a94e56307dc2b962596 (diff) | |
download | chef-20b8bc310e9df2a557cc210abe4f2cae13b10b5c.tar.gz |
Report failed network reads in knife diff
Diffstat (limited to 'lib/chef/knife/diff.rb')
-rw-r--r-- | lib/chef/knife/diff.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/chef/knife/diff.rb b/lib/chef/knife/diff.rb index 20d8b98ef1..d19c714854 100644 --- a/lib/chef/knife/diff.rb +++ b/lib/chef/knife/diff.rb @@ -40,15 +40,21 @@ class Chef # Get the matches (recursively) error = false - patterns.each do |pattern| - found_match = Chef::ChefFS::CommandLine.diff_print(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, output_mode, proc { |entry| format_path(entry) }, config[:diff_filter] ) do |diff| - stdout.print diff - end - if !found_match - ui.error "#{pattern}: No such file or directory on remote or local" - error = true + begin + patterns.each do |pattern| + found_match = Chef::ChefFS::CommandLine.diff_print(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, output_mode, proc { |entry| format_path(entry) }, config[:diff_filter] ) do |diff| + stdout.print diff + end + if !found_match + ui.error "#{pattern}: No such file or directory on remote or local" + error = true + end end + rescue Chef::ChefFS::FileSystem::OperationFailedError => e + ui.error "Failed on #{format_path(e.entry)} in #{e.operation}: #{e.cause}" + error = true end + if error exit 1 end |