fog-ecloud 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1048 -11
  3. data/Rakefile +6 -4
  4. data/lib/fog/compute/ecloud.rb +18 -3
  5. data/lib/fog/compute/ecloud/errors.rb +91 -0
  6. data/lib/fog/compute/ecloud/models/admin_organizations.rb +2 -1
  7. data/lib/fog/compute/ecloud/models/api_keys.rb +2 -1
  8. data/lib/fog/compute/ecloud/models/associations.rb +2 -1
  9. data/lib/fog/compute/ecloud/models/authentication_levels.rb +2 -1
  10. data/lib/fog/compute/ecloud/models/backup_internet_services.rb +2 -1
  11. data/lib/fog/compute/ecloud/models/catalog.rb +3 -2
  12. data/lib/fog/compute/ecloud/models/catalog_configurations.rb +2 -1
  13. data/lib/fog/compute/ecloud/models/compute_pools.rb +2 -1
  14. data/lib/fog/compute/ecloud/models/cpu_usage_detail_summary.rb +2 -1
  15. data/lib/fog/compute/ecloud/models/detached_disks.rb +3 -2
  16. data/lib/fog/compute/ecloud/models/environments.rb +2 -1
  17. data/lib/fog/compute/ecloud/models/firewall_acls.rb +2 -1
  18. data/lib/fog/compute/ecloud/models/groups.rb +2 -1
  19. data/lib/fog/compute/ecloud/models/guest_processes.rb +2 -1
  20. data/lib/fog/compute/ecloud/models/hardware_configurations.rb +2 -1
  21. data/lib/fog/compute/ecloud/models/internet_services.rb +7 -6
  22. data/lib/fog/compute/ecloud/models/ip_addresses.rb +2 -1
  23. data/lib/fog/compute/ecloud/models/layouts.rb +2 -1
  24. data/lib/fog/compute/ecloud/models/locations.rb +2 -1
  25. data/lib/fog/compute/ecloud/models/login_banners.rb +2 -1
  26. data/lib/fog/compute/ecloud/models/memory_usage_detail_summary.rb +2 -1
  27. data/lib/fog/compute/ecloud/models/monitors.rb +2 -1
  28. data/lib/fog/compute/ecloud/models/networks.rb +3 -2
  29. data/lib/fog/compute/ecloud/models/nodes.rb +3 -2
  30. data/lib/fog/compute/ecloud/models/operating_system_families.rb +2 -1
  31. data/lib/fog/compute/ecloud/models/operating_systems.rb +2 -1
  32. data/lib/fog/compute/ecloud/models/organizations.rb +2 -1
  33. data/lib/fog/compute/ecloud/models/password_complexity_rules.rb +2 -1
  34. data/lib/fog/compute/ecloud/models/physical_devices.rb +2 -1
  35. data/lib/fog/compute/ecloud/models/public_ips.rb +3 -2
  36. data/lib/fog/compute/ecloud/models/rnats.rb +2 -1
  37. data/lib/fog/compute/ecloud/models/roles.rb +2 -1
  38. data/lib/fog/compute/ecloud/models/rows.rb +2 -1
  39. data/lib/fog/compute/ecloud/models/server.rb +40 -41
  40. data/lib/fog/compute/ecloud/models/server_configuration_options.rb +2 -1
  41. data/lib/fog/compute/ecloud/models/servers.rb +10 -9
  42. data/lib/fog/compute/ecloud/models/ssh_keys.rb +3 -2
  43. data/lib/fog/compute/ecloud/models/storage_usage_detail_summary.rb +2 -1
  44. data/lib/fog/compute/ecloud/models/support_tickets.rb +2 -1
  45. data/lib/fog/compute/ecloud/models/tags.rb +2 -1
  46. data/lib/fog/compute/ecloud/models/tasks.rb +2 -1
  47. data/lib/fog/compute/ecloud/models/templates.rb +2 -1
  48. data/lib/fog/compute/ecloud/models/trusted_network_groups.rb +2 -1
  49. data/lib/fog/compute/ecloud/models/users.rb +2 -1
  50. data/lib/fog/compute/ecloud/models/virtual_machine_assigned_ips.rb +5 -4
  51. data/lib/fog/compute/ecloud/requests/get_admin_organization.rb +4 -2
  52. data/lib/fog/compute/ecloud/requests/get_compute_pool.rb +4 -2
  53. data/lib/fog/compute/ecloud/requests/get_environment.rb +5 -3
  54. data/lib/fog/compute/ecloud/requests/get_ip_address.rb +5 -3
  55. data/lib/fog/compute/ecloud/requests/get_network.rb +4 -2
  56. data/lib/fog/compute/ecloud/requests/get_operating_system.rb +5 -3
  57. data/lib/fog/compute/ecloud/requests/get_ssh_key.rb +3 -1
  58. data/lib/fog/compute/ecloud/requests/get_template.rb +5 -3
  59. data/lib/fog/compute/ecloud/requests/ssh_key_edit.rb +2 -1
  60. data/lib/fog/ecloud/version.rb +1 -1
  61. data/tests/compute/livespec/auth_tests.rb +101 -0
  62. data/tests/compute/models/ssh_key_tests.rb +12 -11
  63. metadata +4 -2
@@ -20,7 +20,8 @@ module Fog
20
20
  def get(uri)
21
21
  data = service.get_node(uri).body
22
22
  new(data)
23
- rescue Fog::Errors::NotFound
23
+ rescue ServiceError => e
24
+ raise e unless e.status_code == 404
24
25
  nil
25
26
  end
26
27
 
@@ -30,7 +31,7 @@ module Fog
30
31
  options[:enabled] ||= true
31
32
  options[:description] ||= ""
32
33
  data = service.node_service_create(options).body
33
- object = new(data)
34
+ new(data)
34
35
  end
35
36
 
36
37
  def internet_service_id
@@ -17,7 +17,8 @@ module Fog
17
17
  if data = service.get_operating_system(uri)
18
18
  new(data.body)
19
19
  end
20
- rescue Fog::Errors::NotFound
20
+ rescue ServiceError => e
21
+ raise e unless e.status_code == 404
21
22
  nil
22
23
  end
23
24
  end
@@ -16,7 +16,8 @@ module Fog
16
16
  if data = service.get_operating_system(uri)
17
17
  new(data.body)
18
18
  end
19
- rescue Fog::Errors::NotFound
19
+ rescue ServiceError => e
20
+ raise e unless e.status_code == 404
20
21
  nil
21
22
  end
22
23
  end
@@ -19,7 +19,8 @@ module Fog
19
19
  if data = service.get_organization(uri)
20
20
  new(data.body)
21
21
  end
22
- rescue Fog::Errors::NotFound
22
+ rescue ServiceError => e
23
+ raise e unless e.status_code == 404
23
24
  nil
24
25
  end
25
26
 
@@ -17,7 +17,8 @@ module Fog
17
17
  if data = service.get_password_complexity_rule(uri)
18
18
  new(data.body)
19
19
  end
20
- rescue Fog::Errors::NotFound
20
+ rescue ServiceError => e
21
+ raise e unless e.status_code == 404
21
22
  nil
22
23
  end
23
24
  end
@@ -17,7 +17,8 @@ module Fog
17
17
  if data = service.get_physical_device(uri)
18
18
  new(data.body)
19
19
  end
20
- rescue Fog::Errors::NotFound
20
+ rescue ServiceError => e
21
+ raise e unless e.status_code == 404
21
22
  nil
22
23
  end
23
24
  end
@@ -17,13 +17,14 @@ module Fog
17
17
  def get(uri)
18
18
  data = service.get_public_ip(uri).body
19
19
  new(data)
20
- rescue Fog::Errors::NotFound
20
+ rescue ServiceError => e
21
+ raise e unless e.status_code == 404
21
22
  nil
22
23
  end
23
24
 
24
25
  def activate
25
26
  data = service.public_ip_activate(href + "/action/activatePublicIp").body
26
- ip = Fog::Compute::Ecloud::PublicIps.new(:service => service, :href => data[:href])[0]
27
+ Fog::Compute::Ecloud::PublicIps.new(:service => service, :href => data[:href])[0]
27
28
  end
28
29
  end
29
30
  end
@@ -17,7 +17,8 @@ module Fog
17
17
  if data = service.get_rnat(uri)
18
18
  new(data.body)
19
19
  end
20
- rescue Fog::Errors::NotFound
20
+ rescue ServiceError => e
21
+ raise e unless e.status_code == 404
21
22
  nil
22
23
  end
23
24
  end
@@ -27,7 +27,8 @@ module Fog
27
27
  if data = service.get_role(uri)
28
28
  new(data.body)
29
29
  end
30
- rescue Fog::Errors::NotFound
30
+ rescue ServiceError => e
31
+ raise e unless e.status_code == 404
31
32
  nil
32
33
  end
33
34
  end
@@ -20,7 +20,8 @@ module Fog
20
20
  else
21
21
  new(data)
22
22
  end
23
- rescue Excon::Errors::NotFound
23
+ rescue ServiceError => e
24
+ raise e unless e.status_code == 404
24
25
  nil
25
26
  end
26
27
 
@@ -31,7 +31,7 @@ module Fog
31
31
  end
32
32
 
33
33
  def flavor_id
34
- {:ram => hardware_configuration.memory.to_i, :cpus => hardware_configuration.processor_count}
34
+ { :ram => hardware_configuration.memory.to_i, :cpus => hardware_configuration.processor_count }
35
35
  end
36
36
 
37
37
  def storage
@@ -39,7 +39,7 @@ module Fog
39
39
  end
40
40
 
41
41
  def tasks
42
- @tasks ||= self.service.tasks(:href => "#{service.base_path}/tasks/virtualMachines/#{id}")
42
+ @tasks ||= service.tasks(:href => "#{service.base_path}/tasks/virtualMachines/#{id}")
43
43
  end
44
44
 
45
45
  def processes
@@ -47,11 +47,11 @@ module Fog
47
47
  end
48
48
 
49
49
  def hardware_configuration=(hardware_configuration)
50
- @hardware_configuration = self.service.hardware_configurations.new(hardware_configuration)
50
+ @hardware_configuration = service.hardware_configurations.new(hardware_configuration)
51
51
  end
52
52
 
53
53
  def hardware_configuration
54
- @hardware_configuration ||= self.service.hardware_configurations.new(:href => "#{service.base_path}/virtualMachines/#{id}/hardwareConfiguration")
54
+ @hardware_configuration ||= service.hardware_configurations.new(:href => "#{service.base_path}/virtualMachines/#{id}/hardwareConfiguration")
55
55
  @hardware_configuration.reload
56
56
  end
57
57
 
@@ -60,36 +60,36 @@ module Fog
60
60
  end
61
61
 
62
62
  def ips
63
- @ips = self.service.virtual_machine_assigned_ips(:virtual_machine_id => self.id)
63
+ @ips = service.virtual_machine_assigned_ips(:virtual_machine_id => id)
64
64
  end
65
65
 
66
66
  def networks
67
- @networks ||= self.service.networks(:href => "#{service.base_path}/virtualMachines/#{id}/assignedIps")
67
+ @networks ||= service.networks(:href => "#{service.base_path}/virtualMachines/#{id}/assignedIps")
68
68
  end
69
69
 
70
70
  def power_on
71
- power_operation( :power_on => :powerOn )
71
+ power_operation(:power_on => :powerOn)
72
72
  end
73
73
 
74
74
  def power_off
75
- power_operation( :power_off => :powerOff )
75
+ power_operation(:power_off => :powerOff)
76
76
  end
77
77
 
78
78
  def shutdown
79
- power_operation( :power_shutdown => :shutdown )
79
+ power_operation(:power_shutdown => :shutdown)
80
80
  end
81
81
 
82
82
  def power_reset
83
- power_operation( :power_reset => :reboot )
83
+ power_operation(:power_reset => :reboot)
84
84
  end
85
85
 
86
86
  def delete
87
87
  data = service.virtual_machine_delete(href).body
88
- self.service.tasks.new(data)
88
+ service.tasks.new(data)
89
89
  end
90
90
 
91
91
  def copy(options = {})
92
- options = {:type => :copy}.merge(options)
92
+ options = { :type => :copy }.merge(options)
93
93
  options[:source] ||= href
94
94
  if options[:type] == :copy
95
95
  options[:cpus] ||= 1
@@ -103,7 +103,7 @@ module Fog
103
103
  options[:network_uri] = options[:network_uri].is_a?(String) ? [options[:network_uri]] : options[:network_uri]
104
104
  options[:network_uri].each do |uri|
105
105
  index = options[:network_uri].index(uri)
106
- ip = Fog::Compute::Ecloud::IpAddresses.new(:service => service, :href => uri).find { |i| i.host == nil }.name
106
+ ip = Fog::Compute::Ecloud::IpAddresses.new(:service => service, :href => uri).detect { |i| i.host == nil }.name
107
107
  options[:ips] ||= []
108
108
  options[:ips][index] = ip
109
109
  end
@@ -142,7 +142,7 @@ module Fog
142
142
  def edit(options = {})
143
143
  data = service.virtual_machine_edit(href, options).body
144
144
  if data[:type] == "application/vnd.tmrk.cloud.task"
145
- task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0]
145
+ Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0]
146
146
  end
147
147
  end
148
148
 
@@ -150,7 +150,7 @@ module Fog
150
150
  options[:host_ip_href] ||= ips.first.href
151
151
  options[:uri] = "#{service.base_path}/rnats/environments/#{environment_id}/action/createAssociation"
152
152
  data = service.rnat_associations_create_device(options).body
153
- rnat = Fog::Compute::Ecloud::Associations.new(:service => service, :href => data[:href])[0]
153
+ Fog::Compute::Ecloud::Associations.new(:service => service, :href => data[:href])[0]
154
154
  end
155
155
 
156
156
  def disks
@@ -161,18 +161,18 @@ module Fog
161
161
 
162
162
  def add_disk(size)
163
163
  index = disks.map { |d| d[:Index].to_i }.sort[-1] + 1
164
- vm_disks = disks << {:Index => index.to_s, :Size=>{:Unit => "GB", :Value => size.to_s}, :Name => "Hard Disk #{index + 1}"}
164
+ vm_disks = disks << { :Index => index.to_s, :Size => { :Unit => "GB", :Value => size.to_s }, :Name => "Hard Disk #{index + 1}" }
165
165
  data = service.virtual_machine_edit_hardware_configuration(href + "/hardwareConfiguration", _configuration_data(:disks => vm_disks)).body
166
- task = self.service.tasks.new(data)
166
+ service.tasks.new(data)
167
167
  end
168
168
 
169
169
  def detach_disk(index)
170
170
  options = {}
171
- options[:disk] = disks.find { |disk_hash| disk_hash[:Index] == index.to_s }
172
- options[:name] = self.name
173
- options[:description] = self.description
171
+ options[:disk] = disks.detect { |disk_hash| disk_hash[:Index] == index.to_s }
172
+ options[:name] = name
173
+ options[:description] = description
174
174
  data = service.virtual_machine_detach_disk(href + "/hardwareconfiguration/disks/actions/detach", options).body
175
- detached_disk = self.service.detached_disks.new(data)
175
+ service.detached_disks.new(data)
176
176
  end
177
177
 
178
178
  def attach_disk(detached_disk)
@@ -180,13 +180,13 @@ module Fog
180
180
  options[:name] = detached_disk.name
181
181
  options[:href] = detached_disk.href
182
182
  data = service.virtual_machine_attach_disk(href + "/hardwareconfiguration/disks/actions/attach", options).body
183
- task = self.service.tasks.new(data)
183
+ service.tasks.new(data)
184
184
  end
185
185
 
186
186
  def delete_disk(index)
187
187
  vm_disks = disks.delete_if { |h| h[:Index] == index.to_s }
188
188
  data = service.virtual_machine_edit_hardware_configuration(href + "/hardwareconfiguration", _configuration_data(:disks => vm_disks)).body
189
- task = self.service.tasks.new(data)
189
+ service.tasks.new(data)
190
190
  end
191
191
 
192
192
  def nics
@@ -197,9 +197,9 @@ module Fog
197
197
 
198
198
  def add_nic(network)
199
199
  unit_number = nics.map { |n| n[:UnitNumber].to_i }.sort[-1] + 1
200
- vm_nics = nics << {:UnitNumber => unit_number, :Network => {:href => network.href, :name => network.name, :type => "application/vnd.tmrk.cloud.network"}}
200
+ vm_nics = nics << { :UnitNumber => unit_number, :Network => { :href => network.href, :name => network.name, :type => "application/vnd.tmrk.cloud.network" } }
201
201
  data = service.virtual_machine_edit_hardware_configuration(href + "/hardwareConfiguration", _configuration_data(:nics => vm_nics)).body
202
- task = self.service.tasks.new(:href => data[:href])[0]
202
+ service.tasks.new(:href => data[:href])[0]
203
203
  end
204
204
 
205
205
  def add_ip(options)
@@ -211,7 +211,7 @@ module Fog
211
211
  slice_networks = if slice_ips.empty?
212
212
  []
213
213
  else
214
- ips.map { |ip| { :href => ip.network.href, :name => ip.network.name.split(" ")[0], :type => ip.network.type} }.push(:href => options[:href], :name => options[:network_name], :type => "application/vnd.tmrk.cloud.network").uniq
214
+ ips.map { |ip| { :href => ip.network.href, :name => ip.network.name.split(" ")[0], :type => ip.network.type } }.push(:href => options[:href], :name => options[:network_name], :type => "application/vnd.tmrk.cloud.network").uniq
215
215
  end
216
216
  slice_ips = slice_ips.map { |i| { :name => i.address.name, :network_name => i.network.name } }.push(:name => options[:ip], :network_name => options[:network_name]).uniq
217
217
  slice_ips.each do |ip|
@@ -223,7 +223,7 @@ module Fog
223
223
  end
224
224
  end
225
225
  data = service.virtual_machine_edit_assigned_ips(href + "/assignedIps", slice_networks).body
226
- task = self.service.tasks.new(data)
226
+ service.tasks.new(data)
227
227
  end
228
228
 
229
229
  def delete_ip(options)
@@ -243,7 +243,7 @@ module Fog
243
243
  }
244
244
  end # .delete_if { |ip| ip[:href] == options[:href] && ip[:name] == options[:network_name] }
245
245
  end
246
- slice_ips.map! { |i| {:name => i.address.name, :network_name => i.network.name } }.delete_if { |ip| ip[:name] == options[:ip] }
246
+ slice_ips.map! { |i| { :name => i.address.name, :network_name => i.network.name } }.delete_if { |ip| ip[:name] == options[:ip] }
247
247
  slice_ips.each do |ip|
248
248
  slice_networks.each do |network|
249
249
  if network[:name] == ip[:network_name]
@@ -252,7 +252,7 @@ module Fog
252
252
  end
253
253
  end
254
254
  data = service.virtual_machine_edit_assigned_ips(href + "/assignedips", slice_networks).body
255
- task = self.service.tasks.new(data)
255
+ service.tasks.new(data)
256
256
  end
257
257
 
258
258
  def upload_file(options)
@@ -261,16 +261,15 @@ module Fog
261
261
  end
262
262
 
263
263
  def storage_size
264
- vm_disks = disks
265
- disks.map! { |d| d[:Size][:Value].to_i }.reduce(0){|sum,item| sum + item} * 1024 * 1024
264
+ disks.map! { |d| d[:Size][:Value].to_i }.inject(0) { |sum, item| sum + item } * 1024 * 1024
266
265
  end
267
266
 
268
267
  def ready?
269
268
  load_unless_loaded!
270
- unless status =~ /NotDeployed|Orphaned|TaskInProgress|CopyInProgress/
271
- true
272
- else
269
+ if status =~ /NotDeployed|Orphaned|TaskInProgress|CopyInProgress/
273
270
  false
271
+ else
272
+ true
274
273
  end
275
274
  end
276
275
 
@@ -283,16 +282,16 @@ module Fog
283
282
  end
284
283
 
285
284
  def compute_pool_id
286
- other_links.find { |l| l[:type] == "application/vnd.tmrk.cloud.computePool" }[:href].scan(/\d+/)[0]
285
+ other_links.detect { |l| l[:type] == "application/vnd.tmrk.cloud.computePool" }[:href].scan(/\d+/)[0]
287
286
  end
288
287
 
289
288
  def compute_pool
290
289
  reload if other_links.nil?
291
- @compute_pool = self.service.compute_pools.new(:href => other_links.find { |l| l[:type] == "application/vnd.tmrk.cloud.computePool" }[:href])
290
+ @compute_pool = service.compute_pools.new(:href => other_links.detect { |l| l[:type] == "application/vnd.tmrk.cloud.computePool" }[:href])
292
291
  end
293
292
 
294
293
  def environment_id
295
- other_links.find { |l| l[:type] == "application/vnd.tmrk.cloud.environment" }[:href].scan(/\d+/)[0]
294
+ other_links.detect { |l| l[:type] == "application/vnd.tmrk.cloud.environment" }[:href].scan(/\d+/)[0]
296
295
  end
297
296
 
298
297
  def id
@@ -302,15 +301,15 @@ module Fog
302
301
  private
303
302
 
304
303
  def _configuration_data(options = {})
305
- {:cpus => (options[:cpus] || hardware_configuration.processor_count), :memory => (options[:memory] || hardware_configuration.memory), :disks => (options[:disks] || disks), :nics => (options[:nics] || nics)}
304
+ { :cpus => (options[:cpus] || hardware_configuration.processor_count), :memory => (options[:memory] || hardware_configuration.memory), :disks => (options[:disks] || disks), :nics => (options[:nics] || nics) }
306
305
  end
307
306
 
308
307
  def power_operation(op)
309
308
  requires :href
310
309
  begin
311
- service.send(op.keys.first, href + "/action/#{op.values.first}" )
312
- rescue Excon::Errors::Conflict => e
313
- #Frankly we shouldn't get here ...
310
+ service.send(op.keys.first, href + "/action/#{op.values.first}")
311
+ rescue ServiceError => e
312
+ # Frankly we shouldn't get here ...
314
313
  raise e unless e.to_s =~ /because it is already powered o(n|ff)/
315
314
  end
316
315
  true
@@ -17,7 +17,8 @@ module Fog
17
17
  if data = service.get_server_configuration_option(uri)
18
18
  new(data.body)
19
19
  end
20
- rescue Fog::Errors::NotFound
20
+ rescue ServiceError => e
21
+ raise e unless e.status_code == 404
21
22
  nil
22
23
  end
23
24
  end
@@ -23,7 +23,8 @@ module Fog
23
23
  def get(uri)
24
24
  data = service.get_server(uri).body
25
25
  new(data)
26
- rescue Fog::Errors::NotFound
26
+ rescue ServiceError => e
27
+ raise e unless e.status_code == 404
27
28
  nil
28
29
  end
29
30
 
@@ -31,11 +32,11 @@ module Fog
31
32
  new(data)
32
33
  end
33
34
 
34
- def create( template_uri, options )
35
- options[:cpus] ||= 1
36
- options[:memory] ||= 512
35
+ def create(template_uri, options)
36
+ options[:cpus] ||= 1
37
+ options[:memory] ||= 512
37
38
  options[:description] ||= ""
38
- options[:tags] ||= []
39
+ options[:tags] ||= []
39
40
 
40
41
  if template_uri =~ /\/templates\/\d+/
41
42
  options[:uri] = href + "/action/createVirtualMachine"
@@ -46,17 +47,17 @@ module Fog
46
47
  else
47
48
  [*options[:network_uri]].each do |uri|
48
49
  index = options[:network_uri].index(uri)
49
- ip = self.service.ip_addresses(:href => uri).find { |i| i.host == nil && i.detected_on.nil? }.name
50
+ ip = service.ip_addresses(:href => uri).detect { |i| i.host == nil && i.detected_on.nil? }.name
50
51
  options[:ips] ||= []
51
52
  options[:ips][index] = ip
52
53
  end
53
54
  end
54
- data = service.virtual_machine_create_from_template( template_uri, options ).body
55
+ data = service.virtual_machine_create_from_template(template_uri, options).body
55
56
  else
56
57
  options[:uri] = href + "/action/importVirtualMachine"
57
- data = service.virtual_machine_import( template_uri, options ).body
58
+ data = service.virtual_machine_import(template_uri, options).body
58
59
  end
59
- object = self.service.servers.new(data)
60
+ object = service.servers.new(data)
60
61
  object
61
62
  end
62
63
  end
@@ -9,7 +9,7 @@ module Fog
9
9
  model Fog::Compute::Ecloud::SshKey
10
10
 
11
11
  def all
12
- data = service.get_ssh_keys(href).body[:SshKey]
12
+ data = service.get_ssh_keys(href).body[:SshKey] || []
13
13
  load(data)
14
14
  end
15
15
 
@@ -17,7 +17,8 @@ module Fog
17
17
  if data = service.get_ssh_key(uri).body
18
18
  new(data)
19
19
  end
20
- rescue Excon::Errors::NotFound
20
+ rescue ServiceError => e
21
+ raise e unless e.status_code == 404
21
22
  nil
22
23
  end
23
24
 
@@ -17,7 +17,8 @@ module Fog
17
17
  if data = service.get_storage_usage_detail(uri)
18
18
  new(data.body)
19
19
  end
20
- rescue Fog::Errors::NotFound
20
+ rescue ServiceError => e
21
+ raise e unless e.status_code == 404
21
22
  nil
22
23
  end
23
24
  end