fog 1.33.0 → 1.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +47 -0
  3. data/Rakefile +3 -0
  4. data/fog.gemspec +4 -4
  5. data/lib/fog/openstack/baremetal.rb +20 -82
  6. data/lib/fog/openstack/compute.rb +11 -34
  7. data/lib/fog/openstack/core.rb +37 -10
  8. data/lib/fog/openstack/identity.rb +33 -44
  9. data/lib/fog/openstack/identity_v2.rb +14 -84
  10. data/lib/fog/openstack/identity_v3.rb +4 -51
  11. data/lib/fog/openstack/image.rb +22 -83
  12. data/lib/fog/openstack/metering.rb +15 -76
  13. data/lib/fog/openstack/models/compute/server.rb +1 -1
  14. data/lib/fog/openstack/models/orchestration/events.rb +1 -0
  15. data/lib/fog/openstack/models/orchestration/resources.rb +1 -0
  16. data/lib/fog/openstack/models/orchestration/stack.rb +1 -1
  17. data/lib/fog/openstack/models/orchestration/stacks.rb +1 -0
  18. data/lib/fog/openstack/models/orchestration/templates.rb +1 -0
  19. data/lib/fog/openstack/network.rb +21 -21
  20. data/lib/fog/openstack/orchestration.rb +11 -91
  21. data/lib/fog/openstack/planning.rb +19 -81
  22. data/lib/fog/openstack/requests/compute/list_security_groups.rb +9 -1
  23. data/lib/fog/openstack/requests/network/add_router_interface.rb +12 -4
  24. data/lib/fog/openstack/requests/network/create_port.rb +14 -12
  25. data/lib/fog/openstack/requests/network/get_port.rb +4 -0
  26. data/lib/fog/openstack/requests/network/set_tenant.rb +1 -0
  27. data/lib/fog/openstack/storage.rb +18 -57
  28. data/lib/fog/openstack/volume.rb +17 -79
  29. data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +13 -2
  30. data/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb +7 -6
  31. data/lib/fog/vcloud_director/models/compute/vm_customizations.rb +15 -0
  32. data/lib/fog/version.rb +1 -1
  33. data/lib/tasks/changelog_task.rb +1 -0
  34. data/spec/fog/openstack/volume_spec.rb +5 -0
  35. data/tests/compute/helper.rb +0 -6
  36. data/tests/openstack/requests/network/port_tests.rb +14 -12
  37. data/tests/rackspace/requests/storage/object_tests.rb +46 -4
  38. data/tests/vcloud_director/requests/compute/edge_gateway_tests.rb +2 -2
  39. metadata +11 -74
  40. data/lib/fog/bin/dynect.rb +0 -28
  41. data/tests/brightbox/compute/helper.rb +0 -1
  42. data/tests/brightbox/compute/schema.rb +0 -799
  43. data/tests/brightbox/compute_tests.rb +0 -101
  44. data/tests/brightbox/helper.rb +0 -1
  45. data/tests/brightbox/models/compute/account_tests.rb +0 -17
  46. data/tests/brightbox/models/compute/cloud_ip_tests.rb +0 -32
  47. data/tests/brightbox/models/compute/database_server_tests.rb +0 -78
  48. data/tests/brightbox/models/compute/database_snapshot_tests.rb +0 -26
  49. data/tests/brightbox/models/compute/database_type_tests.rb +0 -27
  50. data/tests/brightbox/models/compute/server_tests.rb +0 -19
  51. data/tests/brightbox/oauth2_tests.rb +0 -110
  52. data/tests/brightbox/requests/compute/account_tests.rb +0 -65
  53. data/tests/brightbox/requests/compute/api_client_tests.rb +0 -64
  54. data/tests/brightbox/requests/compute/application_test.rb +0 -63
  55. data/tests/brightbox/requests/compute/cloud_ip_tests.rb +0 -85
  56. data/tests/brightbox/requests/compute/collaboration_tests.rb +0 -39
  57. data/tests/brightbox/requests/compute/database_server_tests.rb +0 -54
  58. data/tests/brightbox/requests/compute/database_snapsnot_tests.rb +0 -47
  59. data/tests/brightbox/requests/compute/database_type_tests.rb +0 -17
  60. data/tests/brightbox/requests/compute/firewall_policy_tests.rb +0 -40
  61. data/tests/brightbox/requests/compute/firewall_rule_tests.rb +0 -43
  62. data/tests/brightbox/requests/compute/helper.rb +0 -41
  63. data/tests/brightbox/requests/compute/image_tests.rb +0 -60
  64. data/tests/brightbox/requests/compute/interface_tests.rb +0 -33
  65. data/tests/brightbox/requests/compute/load_balancer_tests.rb +0 -121
  66. data/tests/brightbox/requests/compute/server_group_tests.rb +0 -96
  67. data/tests/brightbox/requests/compute/server_tests.rb +0 -99
  68. data/tests/brightbox/requests/compute/server_type_tests.rb +0 -34
  69. data/tests/brightbox/requests/compute/user_collaboration_tests.rb +0 -67
  70. data/tests/brightbox/requests/compute/user_tests.rb +0 -38
  71. data/tests/brightbox/requests/compute/zone_tests.rb +0 -34
@@ -7,11 +7,15 @@ module Fog
7
7
  class V2 < Fog::Service
8
8
 
9
9
  requires :openstack_auth_url
10
- recognizes :openstack_auth_token, :openstack_management_url, :persistent,
11
- :openstack_service_type, :openstack_service_name, :openstack_tenant,
12
- :openstack_api_key, :openstack_username, :openstack_current_user_id,
13
- :current_user, :current_tenant,
14
- :openstack_endpoint_type, :openstack_region
10
+ recognizes :openstack_auth_token, :openstack_management_url,
11
+ :persistent, :openstack_service_type, :openstack_service_name,
12
+ :openstack_tenant, :openstack_tenant_id,
13
+ :openstack_api_key, :openstack_username, :openstack_identity_endpoint,
14
+ :current_user, :current_tenant, :openstack_region,
15
+ :openstack_endpoint_type,
16
+ :openstack_project_name, :openstack_project_id,
17
+ :openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
18
+ :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id
15
19
 
16
20
  model_path 'fog/openstack/models/identity_v2'
17
21
  model :tenant
@@ -166,97 +170,23 @@ module Fog
166
170
  end
167
171
 
168
172
  class Real
169
- attr_reader :current_user
170
- attr_reader :current_tenant
171
- attr_reader :unscoped_token
172
-
173
173
  include Fog::Identity::OpenStack::Common
174
174
 
175
175
  def initialize(options={})
176
- @openstack_auth_token = options[:openstack_auth_token]
176
+ initialize_identity options
177
177
 
178
- unless @openstack_auth_token
179
- missing_credentials = Array.new
180
- @openstack_api_key = options[:openstack_api_key]
181
- @openstack_username = options[:openstack_username]
182
- @openstack_region = options[:openstack_region]
183
-
184
- missing_credentials << :openstack_api_key unless @openstack_api_key
185
- missing_credentials << :openstack_username unless @openstack_username
186
- raise ArgumentError, "Missing required arguments: #{missing_credentials.join(', ')}" unless missing_credentials.empty?
187
- end
188
-
189
- @openstack_tenant = options[:openstack_tenant]
190
- @openstack_auth_uri = URI.parse(options[:openstack_auth_url])
191
- @openstack_management_url = options[:openstack_management_url]
192
- @openstack_must_reauthenticate = false
193
- @openstack_service_type = options[:openstack_service_type] || ['identity']
194
- @openstack_service_name = options[:openstack_service_name]
178
+ @openstack_service_type = options[:openstack_service_type] || ['identity']
179
+ @openstack_service_name = options[:openstack_service_name]
195
180
 
196
- @connection_options = options[:connection_options] || {}
181
+ @connection_options = options[:connection_options] || {}
197
182
 
198
- @openstack_current_user_id = options[:openstack_current_user_id]
199
-
200
- @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
201
-
202
- @current_user = options[:current_user]
203
- @current_tenant = options[:current_tenant]
183
+ @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
204
184
 
205
185
  authenticate
206
186
 
207
187
  @persistent = options[:persistent] || false
208
188
  @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
209
189
  end
210
-
211
- def credentials
212
- {:provider => 'openstack',
213
- :openstack_auth_url => @openstack_auth_uri.to_s,
214
- :openstack_auth_token => @auth_token,
215
- :openstack_management_url => @openstack_management_url,
216
- :openstack_current_user_id => @openstack_current_user_id,
217
- :current_user => @current_user,
218
- :current_tenant => @current_tenant}
219
- end
220
-
221
- def reload
222
- @connection.reset
223
- end
224
-
225
- def request(params)
226
- retried = false
227
- begin
228
- response = @connection.request(params.merge({
229
- :headers => {
230
- 'Content-Type' => 'application/json',
231
- 'Accept' => 'application/json',
232
- 'X-Auth-Token' => @auth_token
233
- }.merge!(params[:headers] || {}),
234
- :path => "#{@path}/#{params[:path]}" #,
235
- }))
236
- rescue Excon::Errors::Unauthorized => error
237
- raise if retried
238
- retried = true
239
-
240
- @openstack_must_reauthenticate = true
241
- authenticate
242
- retry
243
- rescue Excon::Errors::HTTPStatusError => error
244
- raise case error
245
- when Excon::Errors::NotFound
246
- Fog::Identity::OpenStack::NotFound.slurp(error)
247
- else
248
- error
249
- end
250
- end
251
- unless response.body.empty?
252
- response.body = Fog::JSON.decode(response.body)
253
- end
254
- response
255
- end
256
-
257
- private
258
-
259
-
260
190
  end
261
191
  end
262
192
  end
@@ -148,71 +148,24 @@ module Fog
148
148
  end
149
149
 
150
150
  class Real
151
- attr_reader :current_user
152
- attr_reader :current_user_id
153
- attr_reader :current_tenant
154
- attr_reader :unscoped_token
155
- attr_accessor :auth_token
156
-
157
151
  include Fog::Identity::OpenStack::Common
158
- include Fog::OpenStack::Core
159
152
 
160
153
  def initialize(options={})
161
154
  initialize_identity options
162
155
 
163
- @openstack_service_type = options[:openstack_service_type] || ['identity_v3','identityv3','identity']
164
- @openstack_service_name = options[:openstack_service_name]
165
-
166
- @connection_options = options[:connection_options] || {}
156
+ @openstack_service_type = options[:openstack_service_type] || ['identity_v3','identityv3','identity']
157
+ @openstack_service_name = options[:openstack_service_name]
167
158
 
168
- @openstack_current_user_id = options[:openstack_current_user_id]
159
+ @connection_options = options[:connection_options] || {}
169
160
 
170
- @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
161
+ @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
171
162
 
172
163
  authenticate
173
164
 
174
165
  @persistent = options[:persistent] || false
175
166
  @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
176
167
  end
177
-
178
- def reload
179
- @connection.reset
180
- end
181
-
182
- def request(params)
183
- retried = false
184
- begin
185
- response = @connection.request(params.merge({
186
- :headers => params.fetch(:headers,{}).merge({
187
- 'Content-Type' => 'application/json',
188
- 'Accept' => 'application/json',
189
- 'X-Auth-Token' => @auth_token
190
- }),
191
- :path => "#{@path}/#{params[:path]}"
192
- }))
193
- rescue Excon::Errors::Unauthorized => error
194
- raise if retried
195
- retried = true
196
-
197
- @openstack_must_reauthenticate = true
198
- authenticate
199
- retry
200
- rescue Excon::Errors::HTTPStatusError => error
201
- raise case error
202
- when Excon::Errors::NotFound
203
- Fog::Identity::OpenStack::NotFound.slurp(error)
204
- else
205
- error
206
- end
207
- end
208
- unless response.body.empty?
209
- response.body = Fog::JSON.decode(response.body)
210
- end
211
- response
212
- end
213
-
214
168
  end
215
-
216
169
  end
217
170
  end
218
171
  end
@@ -6,10 +6,15 @@ module Fog
6
6
  SUPPORTED_VERSIONS = /v1(\.(0|1))*/
7
7
 
8
8
  requires :openstack_auth_url
9
- recognizes :openstack_auth_token, :openstack_management_url, :persistent,
10
- :openstack_service_type, :openstack_service_name, :openstack_tenant,
11
- :openstack_api_key, :openstack_username,
12
- :current_user, :current_tenant, :openstack_endpoint_type, :openstack_region
9
+ recognizes :openstack_auth_token, :openstack_management_url,
10
+ :persistent, :openstack_service_type, :openstack_service_name,
11
+ :openstack_tenant, :openstack_tenant_id,
12
+ :openstack_api_key, :openstack_username, :openstack_identity_endpoint,
13
+ :current_user, :current_tenant, :openstack_region,
14
+ :openstack_endpoint_type,
15
+ :openstack_project_name, :openstack_project_id,
16
+ :openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
17
+ :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id
13
18
 
14
19
  model_path 'fog/openstack/models/image'
15
20
 
@@ -89,55 +94,30 @@ module Fog
89
94
  end
90
95
 
91
96
  class Real
92
- attr_reader :current_user
93
- attr_reader :current_tenant
97
+ include Fog::OpenStack::Core
94
98
 
95
99
  def initialize(options={})
96
- @openstack_auth_token = options[:openstack_auth_token]
100
+ initialize_identity options
97
101
 
98
- unless @openstack_auth_token
99
- missing_credentials = Array.new
100
- @openstack_api_key = options[:openstack_api_key]
101
- @openstack_username = options[:openstack_username]
102
+ @openstack_service_type = options[:openstack_service_type] || ['image']
103
+ @openstack_service_name = options[:openstack_service_name]
104
+ @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
102
105
 
103
- missing_credentials << :openstack_api_key unless @openstack_api_key
104
- missing_credentials << :openstack_username unless @openstack_username
105
- raise ArgumentError, "Missing required arguments: #{missing_credentials.join(', ')}" unless missing_credentials.empty?
106
- end
107
-
108
- @openstack_tenant = options[:openstack_tenant]
109
- @openstack_auth_uri = URI.parse(options[:openstack_auth_url])
110
- @openstack_management_url = options[:openstack_management_url]
111
- @openstack_must_reauthenticate = false
112
- @openstack_service_type = options[:openstack_service_type] || ['image']
113
- @openstack_service_name = options[:openstack_service_name]
114
- @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
115
- @openstack_region = options[:openstack_region]
116
-
117
- @connection_options = options[:connection_options] || {}
118
-
119
- @current_user = options[:current_user]
120
- @current_tenant = options[:current_tenant]
106
+ @connection_options = options[:connection_options] || {}
121
107
 
122
108
  authenticate
123
109
 
110
+ unless @path.match(SUPPORTED_VERSIONS)
111
+ @path = "/" + Fog::OpenStack.get_supported_version(SUPPORTED_VERSIONS,
112
+ @openstack_management_uri,
113
+ @auth_token,
114
+ @connection_options)
115
+ end
116
+
124
117
  @persistent = options[:persistent] || false
125
118
  @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
126
119
  end
127
120
 
128
- def credentials
129
- { :provider => 'openstack',
130
- :openstack_auth_url => @openstack_auth_uri.to_s,
131
- :openstack_auth_token => @auth_token,
132
- :openstack_management_url => @openstack_management_url,
133
- :current_user => @current_user,
134
- :current_tenant => @current_tenant }
135
- end
136
-
137
- def reload
138
- @connection.reset
139
- end
140
-
141
121
  def request(params)
142
122
  begin
143
123
  response = @connection.request(params.merge({
@@ -171,47 +151,6 @@ module Fog
171
151
 
172
152
  private
173
153
 
174
- def authenticate
175
- if !@openstack_management_url || @openstack_must_reauthenticate
176
- options = {
177
- :openstack_tenant => @openstack_tenant,
178
- :openstack_api_key => @openstack_api_key,
179
- :openstack_username => @openstack_username,
180
- :openstack_auth_uri => @openstack_auth_uri,
181
- :openstack_region => @openstack_region,
182
- :openstack_auth_token => @openstack_must_reauthenticate ? nil : @openstack_auth_token,
183
- :openstack_service_type => @openstack_service_type,
184
- :openstack_service_name => @openstack_service_name,
185
- :openstack_endpoint_type => @openstack_endpoint_type
186
- }
187
-
188
- credentials = Fog::OpenStack.authenticate(options, @connection_options)
189
-
190
- @current_user = credentials[:user]
191
- @current_tenant = credentials[:tenant]
192
-
193
- @openstack_must_reauthenticate = false
194
- @auth_token = credentials[:token]
195
- @openstack_management_url = credentials[:server_management_url]
196
- uri = URI.parse(@openstack_management_url)
197
- else
198
- @auth_token = @openstack_auth_token
199
- uri = URI.parse(@openstack_management_url)
200
- end
201
-
202
- @host = uri.host
203
- @path = uri.path
204
- @path.sub!(/\/$/, '')
205
- unless @path.match(SUPPORTED_VERSIONS)
206
- @path = "/" + Fog::OpenStack.get_supported_version(SUPPORTED_VERSIONS,
207
- uri,
208
- @auth_token,
209
- @connection_options)
210
- end
211
- @port = uri.port
212
- @scheme = uri.scheme
213
- true
214
- end
215
154
  end
216
155
  end
217
156
  end
@@ -4,11 +4,15 @@ module Fog
4
4
  module Metering
5
5
  class OpenStack < Fog::Service
6
6
  requires :openstack_auth_url
7
- recognizes :openstack_auth_token, :openstack_management_url, :persistent,
8
- :openstack_service_type, :openstack_service_name, :openstack_tenant,
9
- :openstack_api_key, :openstack_username,
10
- :current_user, :current_tenant,
11
- :openstack_endpoint_type
7
+ recognizes :openstack_auth_token, :openstack_management_url,
8
+ :persistent, :openstack_service_type, :openstack_service_name,
9
+ :openstack_tenant, :openstack_tenant_id,
10
+ :openstack_api_key, :openstack_username, :openstack_identity_endpoint,
11
+ :current_user, :current_tenant, :openstack_region,
12
+ :openstack_endpoint_type,
13
+ :openstack_project_name, :openstack_project_id,
14
+ :openstack_project_domain, :openstack_user_domain, :openstack_domain_name,
15
+ :openstack_project_domain_id, :openstack_user_domain_id, :openstack_domain_id
12
16
 
13
17
  model_path 'fog/openstack/models/metering'
14
18
 
@@ -81,34 +85,16 @@ module Fog
81
85
  end
82
86
 
83
87
  class Real
84
- attr_reader :current_user
85
- attr_reader :current_tenant
88
+ include Fog::OpenStack::Core
86
89
 
87
90
  def initialize(options={})
88
- @openstack_auth_token = options[:openstack_auth_token]
91
+ initialize_identity options
89
92
 
90
- unless @openstack_auth_token
91
- missing_credentials = Array.new
92
- @openstack_api_key = options[:openstack_api_key]
93
- @openstack_username = options[:openstack_username]
93
+ @openstack_service_type = options[:openstack_service_type] || ['metering']
94
+ @openstack_service_name = options[:openstack_service_name]
95
+ @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
94
96
 
95
- missing_credentials << :openstack_api_key unless @openstack_api_key
96
- missing_credentials << :openstack_username unless @openstack_username
97
- raise ArgumentError, "Missing required arguments: #{missing_credentials.join(', ')}" unless missing_credentials.empty?
98
- end
99
-
100
- @openstack_tenant = options[:openstack_tenant]
101
- @openstack_auth_uri = URI.parse(options[:openstack_auth_url])
102
- @openstack_management_url = options[:openstack_management_url]
103
- @openstack_must_reauthenticate = false
104
- @openstack_service_type = options[:openstack_service_type] || ['metering']
105
- @openstack_service_name = options[:openstack_service_name]
106
-
107
- @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'
108
- @connection_options = options[:connection_options] || {}
109
-
110
- @current_user = options[:current_user]
111
- @current_tenant = options[:current_tenant]
97
+ @connection_options = options[:connection_options] || {}
112
98
 
113
99
  authenticate
114
100
 
@@ -116,19 +102,6 @@ module Fog
116
102
  @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
117
103
  end
118
104
 
119
- def credentials
120
- { :provider => 'openstack',
121
- :openstack_auth_url => @openstack_auth_uri.to_s,
122
- :openstack_auth_token => @auth_token,
123
- :openstack_management_url => @openstack_management_url,
124
- :current_user => @current_user,
125
- :current_tenant => @current_tenant }
126
- end
127
-
128
- def reload
129
- @connection.reset
130
- end
131
-
132
105
  def request(params)
133
106
  begin
134
107
  response = @connection.request(params.merge({
@@ -165,40 +138,6 @@ module Fog
165
138
 
166
139
  private
167
140
 
168
- def authenticate
169
- if !@openstack_management_url || @openstack_must_reauthenticate
170
- options = {
171
- :openstack_tenant => @openstack_tenant,
172
- :openstack_api_key => @openstack_api_key,
173
- :openstack_username => @openstack_username,
174
- :openstack_auth_uri => @openstack_auth_uri,
175
- :openstack_auth_token => @openstack_must_reauthenticate ? nil : @openstack_auth_token,
176
- :openstack_service_type => @openstack_service_type,
177
- :openstack_service_name => @openstack_service_name,
178
- :openstack_endpoint_type => @openstack_endpoint_type
179
- }
180
-
181
- credentials = Fog::OpenStack.authenticate(options, @connection_options)
182
-
183
- @current_user = credentials[:user]
184
- @current_tenant = credentials[:tenant]
185
-
186
- @openstack_must_reauthenticate = false
187
- @auth_token = credentials[:token]
188
- @openstack_management_url = credentials[:server_management_url]
189
- uri = URI.parse(@openstack_management_url)
190
- else
191
- @auth_token = @openstack_auth_token
192
- uri = URI.parse(@openstack_management_url)
193
- end
194
-
195
- @host = uri.host
196
- @path = uri.path
197
- @path.sub!(/\/$/, '')
198
- @port = uri.port
199
- @scheme = uri.scheme
200
- true
201
- end
202
141
  end
203
142
  end
204
143
  end