fog-profitbricks 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -3
  3. data/Rakefile +1 -1
  4. data/examples/pb_demo.rb +2 -8
  5. data/lib/fog/profitbricks/compute.rb +249 -105
  6. data/lib/fog/profitbricks/models/compute/datacenter.rb +63 -9
  7. data/lib/fog/profitbricks/models/compute/firewall_rule.rb +3 -1
  8. data/lib/fog/profitbricks/models/compute/group.rb +7 -4
  9. data/lib/fog/profitbricks/models/compute/image.rb +3 -0
  10. data/lib/fog/profitbricks/models/compute/ip_block.rb +2 -0
  11. data/lib/fog/profitbricks/models/compute/lan.rb +2 -1
  12. data/lib/fog/profitbricks/models/compute/load_balancer.rb +2 -0
  13. data/lib/fog/profitbricks/models/compute/location.rb +1 -0
  14. data/lib/fog/profitbricks/models/compute/nic.rb +2 -0
  15. data/lib/fog/profitbricks/models/compute/request.rb +1 -0
  16. data/lib/fog/profitbricks/models/compute/resource.rb +1 -0
  17. data/lib/fog/profitbricks/models/compute/server.rb +5 -1
  18. data/lib/fog/profitbricks/models/compute/share.rb +4 -2
  19. data/lib/fog/profitbricks/models/compute/snapshot.rb +2 -0
  20. data/lib/fog/profitbricks/models/compute/user.rb +4 -1
  21. data/lib/fog/profitbricks/requests/compute/add_share.rb +2 -2
  22. data/lib/fog/profitbricks/requests/compute/add_user_to_group.rb +4 -4
  23. data/lib/fog/profitbricks/requests/compute/associate_nic_to_load_balancer.rb +1 -3
  24. data/lib/fog/profitbricks/requests/compute/attach_cdrom.rb +18 -17
  25. data/lib/fog/profitbricks/requests/compute/attach_volume.rb +9 -2
  26. data/lib/fog/profitbricks/requests/compute/create_datacenter.rb +71 -25
  27. data/lib/fog/profitbricks/requests/compute/create_firewall_rule.rb +11 -4
  28. data/lib/fog/profitbricks/requests/compute/create_group.rb +22 -4
  29. data/lib/fog/profitbricks/requests/compute/create_ip_block.rb +1 -1
  30. data/lib/fog/profitbricks/requests/compute/create_lan.rb +1 -1
  31. data/lib/fog/profitbricks/requests/compute/create_load_balancer.rb +4 -43
  32. data/lib/fog/profitbricks/requests/compute/create_nic.rb +4 -0
  33. data/lib/fog/profitbricks/requests/compute/create_server.rb +6 -1
  34. data/lib/fog/profitbricks/requests/compute/create_user.rb +20 -1
  35. data/lib/fog/profitbricks/requests/compute/create_volume.rb +5 -1
  36. data/lib/fog/profitbricks/requests/compute/create_volume_snapshot.rb +1 -1
  37. data/lib/fog/profitbricks/requests/compute/delete_group.rb +1 -1
  38. data/lib/fog/profitbricks/requests/compute/delete_share.rb +1 -1
  39. data/lib/fog/profitbricks/requests/compute/delete_user.rb +1 -1
  40. data/lib/fog/profitbricks/requests/compute/detach_cdrom.rb +3 -3
  41. data/lib/fog/profitbricks/requests/compute/get_attached_cdrom.rb +3 -3
  42. data/lib/fog/profitbricks/requests/compute/get_datacenter.rb +1 -1
  43. data/lib/fog/profitbricks/requests/compute/get_firewall_rule.rb +1 -1
  44. data/lib/fog/profitbricks/requests/compute/get_group.rb +1 -1
  45. data/lib/fog/profitbricks/requests/compute/get_image.rb +1 -1
  46. data/lib/fog/profitbricks/requests/compute/get_ip_block.rb +1 -1
  47. data/lib/fog/profitbricks/requests/compute/get_lan.rb +1 -1
  48. data/lib/fog/profitbricks/requests/compute/get_load_balanced_nic.rb +7 -1
  49. data/lib/fog/profitbricks/requests/compute/get_load_balancer.rb +1 -1
  50. data/lib/fog/profitbricks/requests/compute/get_location.rb +1 -1
  51. data/lib/fog/profitbricks/requests/compute/get_nic.rb +2 -2
  52. data/lib/fog/profitbricks/requests/compute/get_request.rb +8 -1
  53. data/lib/fog/profitbricks/requests/compute/get_resource_by_type.rb +8 -1
  54. data/lib/fog/profitbricks/requests/compute/get_resources_by_type.rb +9 -3
  55. data/lib/fog/profitbricks/requests/compute/get_server.rb +1 -1
  56. data/lib/fog/profitbricks/requests/compute/get_share.rb +1 -1
  57. data/lib/fog/profitbricks/requests/compute/get_snapshot.rb +1 -1
  58. data/lib/fog/profitbricks/requests/compute/get_user.rb +1 -1
  59. data/lib/fog/profitbricks/requests/compute/get_volume.rb +1 -1
  60. data/lib/fog/profitbricks/requests/compute/list_attached_cdroms.rb +3 -1
  61. data/lib/fog/profitbricks/requests/compute/list_attached_volumes.rb +3 -3
  62. data/lib/fog/profitbricks/requests/compute/remove_user_from_group.rb +2 -2
  63. data/lib/fog/profitbricks/requests/compute/update_datacenter.rb +3 -8
  64. data/lib/fog/profitbricks/requests/compute/update_firewall_rule.rb +1 -1
  65. data/lib/fog/profitbricks/requests/compute/update_group.rb +5 -5
  66. data/lib/fog/profitbricks/requests/compute/update_nic.rb +2 -4
  67. data/lib/fog/profitbricks/requests/compute/update_server.rb +3 -4
  68. data/lib/fog/profitbricks/requests/compute/update_share.rb +3 -3
  69. data/lib/fog/profitbricks/requests/compute/update_user.rb +2 -2
  70. data/lib/fog/profitbricks/version.rb +1 -1
  71. data/tests/profitbricks/models/compute/compute_tests.rb +1071 -267
  72. metadata +26 -33
  73. data/gemfiles/Gemfile.1.8.7 +0 -6
  74. data/tests/profitbricks/requests/compute/composite_create_tests.rb +0 -174
  75. data/tests/profitbricks/requests/compute/flavor_tests.rb +0 -40
  76. data/tests/profitbricks/requests/compute/location_tests.rb +0 -42
  77. data/tests/profitbricks/requests/compute/nic_tests.rb +0 -268
  78. data/tests/profitbricks/requests/compute/request_tests.rb +0 -50
  79. data/tests/profitbricks/requests/compute/server_tests.rb +0 -462
@@ -9,6 +9,10 @@ module Fog
9
9
  # * name<~String> - The name of the data center
10
10
  # * region<~String> - The physical location where the data center will be created ("de/fkb", "de/fra", or "us/las")
11
11
  # * description<~String> - An optional description for the data center, e.g. staging, production.
12
+ # * servers<~Hash> - A collection of servers
13
+ # * volumes<~Hash> - A collection of volumes
14
+ # * loadbalancers<~Hash> - A collection of loadbalancers
15
+ # * lans<~Hash> - A collection of LANs in a data center
12
16
  #
13
17
  # ==== Returns
14
18
  # * response<~Excon::Response>:
@@ -36,50 +40,92 @@ module Fog
36
40
  # * lans<~Hash> - A collection that represents the LANs in a data center
37
41
  #
38
42
  # {ProfitBricks API Documentation}[https://devops.profitbricks.com/api/cloud/v2/#create-a-data-center]
39
- def create_datacenter(options)
43
+ def create_datacenter(options, entities={})
40
44
  datacenter = {
41
- :properties => options
45
+ :properties => options,
46
+ :entities => entities
42
47
  }
43
48
 
44
49
  request(
45
- :expects => [202],
46
- :method => 'POST',
47
- :path => '/datacenters',
48
- :body => Fog::JSON.encode(datacenter)
50
+ :expects => [202],
51
+ :method => 'POST',
52
+ :path => '/datacenters',
53
+ :body => Fog::JSON.encode(datacenter)
49
54
  )
50
55
  end
51
56
  end
52
57
 
53
58
  class Mock
54
- def create_datacenter(_options)
59
+ def create_datacenter(options, entities={})
60
+ dc = {
61
+ :properties => options,
62
+ :entities => entities
63
+ }
64
+
65
+ if dc[:properties][:location] == nil
66
+ raise Excon::Error::HTTPStatus, "Attribute 'location' is required"
67
+ end
68
+
55
69
  dc_3_id = Fog::UUID.uuid
70
+ dc_4_id = Fog::UUID.uuid
56
71
  datacenter = {
57
72
  'id' => dc_3_id,
58
73
  'type' => 'datacenter',
59
- 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{dc_3_id}",
60
- 'metadata' => {
61
- 'createdDate' => '2016-07-31T15:41:27Z',
62
- 'createdBy' => 'test@stackpointcloud.com',
63
- 'etag' => '5b91832ee85a758568d4523a86bd8702',
64
- 'lastModifiedDate' => '2016-07-31T15:41:27Z',
65
- 'lastModifiedBy' => 'test@stackpointcloud.com',
66
- 'state' => 'AVAILABLE'
67
- },
68
74
  'properties' => {
69
- 'name' => 'fog-demo',
70
- 'description' => 'testing fog rest implementation',
71
- 'location' => 'de/fra',
72
- 'version' => 1,
73
- 'features' => [
74
-
75
- ]
75
+ 'name' => dc[:properties][:name],
76
+ 'description' => dc[:properties][:description],
77
+ 'location' => dc[:properties][:location],
78
+ 'version' => 1
76
79
  }
77
80
  }
78
81
 
82
+ if entities != nil and entities != {}
83
+ datacenter = {
84
+ 'id' => dc_4_id,
85
+ 'type' => 'datacenter',
86
+ 'properties' => {
87
+ 'name' => dc[:properties][:name],
88
+ 'description' => dc[:properties][:description],
89
+ 'location' => dc[:properties][:location],
90
+ 'version' => 1
91
+ },
92
+ 'entities' => {
93
+ 'volumes' => {
94
+ 'items' =>
95
+ [
96
+ {
97
+ 'type' => 'volume',
98
+ 'properties' => {
99
+ 'name' => dc[:entities][:volumes][:items][0][:properties][:name],
100
+ 'type' => dc[:entities][:volumes][:items][0][:properties][:type],
101
+ 'size' => dc[:entities][:volumes][:items][0][:properties][:size],
102
+ 'bus' => dc[:entities][:volumes][:items][0][:properties][:bus],
103
+ 'licenceType' => dc[:entities][:volumes][:items][0][:properties][:licenceType],
104
+ 'availabilityZone' => dc[:entities][:volumes][:items][0][:properties][:availabilityZone]
105
+ }
106
+ }
107
+ ]
108
+ },
109
+ 'servers' => {
110
+ 'items' =>
111
+ [
112
+ {
113
+ 'properties' => {
114
+ 'name' => dc[:entities][:servers][:items][0][:properties][:name],
115
+ 'cores' => dc[:entities][:servers][:items][0][:properties][:cores],
116
+ 'ram' => dc[:entities][:servers][:items][0][:properties][:ram]
117
+ }
118
+ }
119
+ ]
120
+ }
121
+ }
122
+ }
123
+ end
124
+
79
125
  data[:datacenters]['items'] << datacenter
80
- response = Excon::Response.new
126
+ response = Excon::Response.new
81
127
  response.status = 202
82
- response.body = datacenter
128
+ response.body = datacenter
83
129
  response
84
130
  end
85
131
  end
@@ -71,10 +71,17 @@ module Fog
71
71
  response = Excon::Response.new
72
72
  response.status = 202
73
73
 
74
+ properties = {}
75
+ properties['name'] = options[:name]
76
+ properties['protocol'] = options[:protocol]
77
+ properties['source_mac'] = options[:sourceMac]
78
+ properties['port_range_start'] = options[:portRangeStart]
79
+ properties['port_range_end'] = options[:portRangeEnd]
80
+
74
81
  firewall_rule_id = Fog::UUID.uuid
75
82
  firewall_rule = {
76
83
  'id' => firewall_rule_id,
77
- 'type' => 'nic',
84
+ 'type' => 'firewall-rule',
78
85
  'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/servers/#{server_id}/nics/#{nic_id}/firewallrules/#{firewall_rule_id}",
79
86
  'metadata' => {
80
87
  'createdDate' => '2015-03-18T19:00:51Z',
@@ -84,10 +91,10 @@ module Fog
84
91
  'lastModifiedBy' => 'test@stackpointcloud.com',
85
92
  'state' => 'AVAILABLE'
86
93
  },
87
- 'properties' => options,
94
+ 'properties' => properties,
88
95
  'datacenter_id' => datacenter_id,
89
- 'server_id' => server_id,
90
- 'nic_id' => nic_id
96
+ 'server_id' => server_id,
97
+ 'nic_id' => nic_id
91
98
  }
92
99
 
93
100
  data[:firewall_rules]['items'] << firewall_rule
@@ -56,6 +56,10 @@ module Fog
56
56
 
57
57
  class Mock
58
58
  def create_group(options = {})
59
+ if options[:name] == nil
60
+ raise Excon::Error::HTTPStatus, "Attribute 'name' is required"
61
+ end
62
+
59
63
  response = Excon::Response.new
60
64
  response.status = 202
61
65
 
@@ -67,10 +71,24 @@ module Fog
67
71
  'href' => "https=>//api.profitbricks.com/rest/v4/um/groups/#{group_id}",
68
72
  'properties' => {
69
73
  'name' => options[:name],
70
- 'createDataCenter' => options[:create_data_center],
71
- 'createSnapshot' => options[:create_snapshot],
72
- 'reserveIp' => options[:reserve_ip],
73
- 'accessActivityLog' => options[:access_activity_log]
74
+ 'createDataCenter' => options[:createDataCenter],
75
+ 'createSnapshot' => options[:createSnapshot],
76
+ 'reserveIp' => options[:reserveIp],
77
+ 'accessActivityLog' => options[:accessActivityLog]
78
+ },
79
+ 'entities' => {
80
+ 'users' => {
81
+ 'id' => "#{group_id}/owns",
82
+ 'type' => 'collection',
83
+ 'href' => "https://api.profitbricks.com/cloudapi/v4/um/groups/#{group_id}/users",
84
+ 'items' => []
85
+ },
86
+ 'resources' => {
87
+ 'id' => "#{group_id}/resources",
88
+ 'type' => 'collection',
89
+ 'href' => "https://api.profitbricks.com/cloudapi/v4/um/groups/#{group_id}/resources",
90
+ 'items' => []
91
+ }
74
92
  }
75
93
  }
76
94
 
@@ -60,7 +60,7 @@ module Fog
60
60
  'state' => 'AVAILABLE'
61
61
  },
62
62
  'properties' => {
63
- 'ips' => ["777.777.777.777", "888.888.888.888", "999.999.999.999"],
63
+ 'ips' => ["777.777.777.777", "888.888.888.888"],
64
64
  'location' => options[:location],
65
65
  'size' => options[:size],
66
66
  'name' => options[:name]
@@ -126,7 +126,7 @@ module Fog
126
126
 
127
127
  lan = {
128
128
  'id' => '10',
129
- 'type' => 'nic',
129
+ 'type' => 'lan',
130
130
  'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/lans/10",
131
131
  'metadata' => {
132
132
  'createdDate' => '2015-03-18T19:00:51Z',
@@ -52,17 +52,18 @@ module Fog
52
52
  end
53
53
 
54
54
  class Mock
55
- def create_load_balancer(datacenter_id, properties = {}, _entities = {})
55
+ def create_load_balancer(datacenter_id, properties = {}, entities = {})
56
56
  response = Excon::Response.new
57
57
  response.status = 202
58
58
 
59
59
  load_balancer_id = Fog::UUID.uuid
60
60
  nic_1_id = Fog::UUID.uuid
61
61
  serv_1_id = Fog::UUID.uuid
62
+ properties[:ip] = '123.456.789'
62
63
 
63
64
  load_balancer = {
64
65
  'id' => load_balancer_id,
65
- 'type' => 'nic',
66
+ 'type' => 'loadbalancer',
66
67
  'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}",
67
68
  'metadata' => {
68
69
  'createdDate' => '2015-03-18T19:00:51Z',
@@ -73,47 +74,7 @@ module Fog
73
74
  'state' => 'AVAILABLE'
74
75
  },
75
76
  'properties' => properties,
76
- 'entities' => {
77
- 'balancednics' => {
78
- 'id' => "#{load_balancer_id}/balancednics",
79
- 'type' => 'collection',
80
- 'href' => "https=>//api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/loadbalancers/#{load_balancer_id}/balancednics",
81
- 'items' =>
82
- [
83
- {
84
- 'id' => nic_1_id,
85
- 'type' => 'nic',
86
- 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/servers/#{serv_1_id}/nics/#{nic_1_id}",
87
- 'metadata' => {
88
- 'createdDate' => '2015-03-18T19:00:51Z',
89
- 'createdBy' => 'test@stackpointcloud.com',
90
- 'etag' => 'faa67fbacb1c0e2e02cf9650657251f1',
91
- 'lastModifiedDate' => '2015-03-18T19:00:51Z',
92
- 'lastModifiedBy' => 'test@stackpointcloud.com',
93
- 'state' => 'AVAILABLE'
94
- },
95
- 'properties' => {
96
- 'name' => 'FogTestLoadBalancedNIC_1',
97
- 'mac' => '02:01:36:5f:09:da',
98
- 'ips' => ['10.9.194.12'],
99
- 'dhcp' => 'true',
100
- 'lan' => 2,
101
- 'firewallActive' => 'false'
102
- },
103
- 'entities' => {
104
- 'firewallrules' => {
105
- 'id' => "#{nic_1_id}/firewallrules",
106
- 'type' => 'collection',
107
- 'href' => "https://api.profitbricks.com/rest/v2/datacenters/#{datacenter_id}/servers/#{serv_1_id}/nics/#{nic_1_id}/firewallrules",
108
- 'items' => []
109
- }
110
- },
111
- 'datacenter_id' => datacenter_id,
112
- 'load_balancer_id' => load_balancer_id
113
- }
114
- ]
115
- }
116
- },
77
+ 'entities' => entities,
117
78
  'datacenter_id' => datacenter_id
118
79
  }
119
80
 
@@ -89,6 +89,10 @@ module Fog
89
89
 
90
90
  class Mock
91
91
  def create_nic(datacenter_id, server_id, options = {}, entities = {})
92
+ if options[:lan] == nil
93
+ raise Excon::Error::HTTPStatus, "Attribute 'lan' is required"
94
+ end
95
+
92
96
  response = Excon::Response.new
93
97
  response.status = 202
94
98
 
@@ -133,6 +133,10 @@ module Fog
133
133
 
134
134
  class Mock
135
135
  def create_server(datacenter_id, properties = {}, entities = {})
136
+ if properties[:cores] == nil
137
+ raise Excon::Error::HTTPStatus, "Attribute 'cores' is required"
138
+ end
139
+
136
140
  server_id = Fog::UUID.uuid
137
141
 
138
142
  volume_id = if entities[:volumes] && entities[:volumes]['items'] && entities[:volumes]['items'][0] && entities[:volumes]['items'][0]['id']
@@ -160,7 +164,8 @@ module Fog
160
164
  'ram' => properties[:ram],
161
165
  'availabilityZone' => properties[:availabilityZone],
162
166
  'vmState' => 'RUNNING',
163
- 'cpuFamily' => properties[:cpuFamily]
167
+ 'cpuFamily' => properties[:cpuFamily],
168
+ 'bootVolume' => properties[:bootVolume]
164
169
  }
165
170
  }
166
171
 
@@ -48,6 +48,10 @@ module Fog
48
48
 
49
49
  class Mock
50
50
  def create_user(options = {})
51
+ if options[:email] == nil
52
+ raise Excon::Error::HTTPStatus, "Attribute 'email' is required"
53
+ end
54
+
51
55
  response = Excon::Response.new
52
56
  response.status = 202
53
57
 
@@ -68,7 +72,22 @@ module Fog
68
72
  'email' => options[:email],
69
73
  'password' => options[:password],
70
74
  'administrator' => options[:administrator],
71
- 'forceSecAuth' => options[:force_sec_auth]
75
+ 'forceSecAuth' => options[:force_sec_auth] || false,
76
+ 'secAuthActive' => options[:sec_auth_active] || false
77
+ },
78
+ 'entities' => {
79
+ 'owns' => {
80
+ 'id' => "#{user_id}/owns",
81
+ 'type' => 'collection',
82
+ 'href' => "https://api.profitbricks.com/cloudapi/v4/um/users/#{user_id}/owns",
83
+ 'items' => []
84
+ },
85
+ 'groups' => {
86
+ 'id' => "#{user_id}/groups",
87
+ 'type' => 'collection',
88
+ 'href' => "https://api.profitbricks.com/cloudapi/v4/um/users/#{user_id}/groups",
89
+ 'items' => []
90
+ }
72
91
  }
73
92
  }
74
93
 
@@ -77,13 +77,17 @@ module Fog
77
77
  response = Excon::Response.new
78
78
  response.status = 202
79
79
 
80
+ if options[:size] == nil
81
+ raise Excon::Error::HTTPStatus, "Attribute 'size' is required"
82
+ end
83
+
80
84
  if datacenter = data[:datacenters]['items'].find do |attrib|
81
85
  attrib['id'] == datacenter_id
82
86
  end
83
87
 
84
88
  datacenter['version'] += 1 if datacenter['version']
85
89
  else
86
- raise Fog::Errors::NotFound, 'Data center resource could not be found'
90
+ raise Excon::Error::HTTPStatus, 'Resource does not exist'
87
91
  end
88
92
 
89
93
  volume_id = Fog::UUID.uuid
@@ -84,7 +84,7 @@ module Fog
84
84
  'name' => options[:name],
85
85
  'description' => options[:description],
86
86
  'location' => 'us/las',
87
- 'size' => 6,
87
+ 'size' => 5,
88
88
  'cpuHotPlug' => 'true',
89
89
  'cpuHotUnplug' => 'false',
90
90
  'ramHotPlug' => 'false',
@@ -32,7 +32,7 @@ module Fog
32
32
  grp['id'] == group_id
33
33
  end
34
34
  else
35
- raise Fog::Errors::NotFound, "The requested resource could not be found"
35
+ raise Excon::Error::HTTPStatus, "Resource does not exist"
36
36
  end
37
37
 
38
38
  response
@@ -31,7 +31,7 @@ module Fog
31
31
  shr['id'] == resource_id
32
32
  end
33
33
  else
34
- raise Fog::Errors::NotFound, "The requested resource could not be found"
34
+ raise Excon::Error::HTTPStatus, "Resource does not exist"
35
35
  end
36
36
 
37
37
  response
@@ -32,7 +32,7 @@ module Fog
32
32
  usr['id'] == user_id
33
33
  end
34
34
  else
35
- raise Fog::Errors::NotFound, "The requested resource could not be found"
35
+ raise Excon::Error::HTTPStatus, "Resource does not exist"
36
36
  end
37
37
 
38
38
  response
@@ -32,14 +32,14 @@ module Fog
32
32
  serv['datacenter_id'] == datacenter_id && serv['id'] == server_id
33
33
  end
34
34
  else
35
- raise Fog::Errors::NotFound, "The server resource could not be found"
35
+ raise Excon::Error::HTTPStatus, "Resource does not exist"
36
36
  end
37
37
 
38
- if cdrom = server['entities']['cdroms']['items'].find do |cd|
38
+ if cdrom = server['cdroms']['items'].find do |cd|
39
39
  cd['id'] == cdrom_id
40
40
  end
41
41
  else
42
- raise Fog::Errors::NotFound, "The attached volume resource could not be found"
42
+ raise Excon::Error::HTTPStatus, "Resource does not exist"
43
43
  end
44
44
 
45
45
  response
@@ -57,14 +57,14 @@ module Fog
57
57
  serv['datacenter_id'] == datacenter_id && serv['id'] == server_id
58
58
  end
59
59
  else
60
- raise Fog::Errors::NotFound, "The server resource could not be found"
60
+ raise Excon::Error::HTTPStatus, "Resource does not exist"
61
61
  end
62
62
 
63
- if cdrom = server['entities']['cdroms']['items'].find do |cd|
63
+ if cdrom = server['cdroms']['items'].find do |cd|
64
64
  cd['id'] == cdrom_image_id
65
65
  end
66
66
  else
67
- raise Fog::Errors::NotFound, "The attached volume resource could not be found"
67
+ raise Excon::Error::HTTPStatus, "Resource does not exist"
68
68
  end
69
69
 
70
70
  response = Excon::Response.new