knife-essentials 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,15 +42,21 @@ class Chef
42
42
 
43
43
  # Get the matches (recursively)
44
44
  error = false
45
- patterns.each do |pattern|
46
- found_match = 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|
47
- stdout.print diff
48
- end
49
- if !found_match
50
- ui.error "#{pattern}: No such file or directory on remote or local"
51
- error = true
45
+ begin
46
+ patterns.each do |pattern|
47
+ found_match = 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|
48
+ stdout.print diff
49
+ end
50
+ if !found_match
51
+ ui.error "#{pattern}: No such file or directory on remote or local"
52
+ error = true
53
+ end
52
54
  end
55
+ rescue ChefFS::FileSystem::OperationFailedError => e
56
+ ui.error "Failed on #{format_path(e.entry)} in #{e.operation}: #{e.message}"
57
+ error = true
53
58
  end
59
+
54
60
  if error
55
61
  exit 1
56
62
  end
@@ -37,16 +37,19 @@ module ChefFS
37
37
  old_sign_on_redirect = rest.sign_on_redirect
38
38
  rest.sign_on_redirect = false
39
39
  begin
40
- begin
41
- tmpfile = rest.get_rest(file[:url], true)
42
- tmpfile.open
43
- tmpfile.read
44
- ensure
45
- tmpfile.close!
46
- end
40
+ tmpfile = rest.get_rest(file[:url], true)
41
+ rescue Net::HTTPServerException => e
42
+ raise ChefFS::FileSystem::OperationFailedError.new(:read, self, e), "#{e.message} retrieving #{file[:url]}"
47
43
  ensure
48
44
  rest.sign_on_redirect = old_sign_on_redirect
49
45
  end
46
+
47
+ begin
48
+ tmpfile.open
49
+ tmpfile.read
50
+ ensure
51
+ tmpfile.close!
52
+ end
50
53
  end
51
54
 
52
55
  def rest
@@ -47,11 +47,11 @@ module ChefFS
47
47
  @children ||= rest.get_rest(api_path).keys.sort.map do |key|
48
48
  _make_child_entry("#{key}.json", true)
49
49
  end
50
- rescue Net::HTTPServerException
50
+ rescue Net::HTTPServerException => e
51
51
  if $!.response.code == "404"
52
52
  raise ChefFS::FileSystem::NotFoundError.new(self, $!)
53
53
  else
54
- raise
54
+ raise ChefFS::FileSystem::OperationFailedError.new(:children, self, e)
55
55
  end
56
56
  end
57
57
  end
@@ -81,11 +81,11 @@ module ChefFS
81
81
  begin
82
82
  # REST will inflate the Chef object using json_class
83
83
  rest.get_rest(api_path)
84
- rescue Net::HTTPServerException
84
+ rescue Net::HTTPServerException => e
85
85
  if $!.response.code == "404"
86
86
  raise ChefFS::FileSystem::NotFoundError.new(self, $!)
87
87
  else
88
- raise
88
+ raise ChefFS::FileSystem::OperationFailedError.new(:read, self, e)
89
89
  end
90
90
  end
91
91
  end
@@ -1,4 +1,3 @@
1
1
  module ChefFS
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
4
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-essentials
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-21 00:00:00.000000000 Z
12
+ date: 2013-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef-zero