fog-openstack 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20ea80cf3dba819dede79cf55ec6ac57a55f3d7c
4
- data.tar.gz: 8e28c773ea76b1685b870ebb0b0eb2d501bc896f
3
+ metadata.gz: e709d55ce5fa6e2513278e19a6f949053ac3d9ab
4
+ data.tar.gz: '0948ccd18c50d50da4fb742dbf4837cd70afb351'
5
5
  SHA512:
6
- metadata.gz: 6d5af4a6ba1a1fc57e49e2db611de5b93a150a101973f8cde96e8af3ff7ff98b1519e029d8dc3cc26629fcdcad23220f4cb7c0698fe9476881d60f1bb04eb362
7
- data.tar.gz: 8c8c32dc3222008cb8121593d463c427908d195418e2bac083a27a7c90837a12a9796d0c17523a40321c9d1c4d34607af319792886629c8e86bcfc8ca8b66ff8
6
+ metadata.gz: c84b8d3f4a0f8ca80601595a606148e28c38729c4180b9969c23b17514699596a278dab94b5ce321586ef9a0af5cf1de963aa070fd0c2a6f27e8cfe51e5f7a98
7
+ data.tar.gz: cf712ed9aae98300e32b68a0c99a264d3c1dc79fb8975ef8da1c85e5228e4b629c0a14136fe08287654a7ed68c2d839131a48348ef0570bcdd3d36f0e9b69d37
@@ -111,7 +111,7 @@ module Fog
111
111
  end
112
112
 
113
113
  def default_service_type
114
- %w[image]
114
+ %w[imagev1]
115
115
  end
116
116
  end
117
117
  end
@@ -119,7 +119,7 @@ module Fog
119
119
  end
120
120
 
121
121
  def default_service_type
122
- %w[image]
122
+ %w[image imagev2]
123
123
  end
124
124
  end
125
125
  end
@@ -13,35 +13,34 @@ module Fog
13
13
  class StandardError < RuntimeError; end
14
14
  class URLError < RuntimeError; end
15
15
 
16
- def self.build(auth)
16
+ def self.build(auth, options)
17
17
  if auth[:openstack_identity_api_version] =~ /(v)*2(\.0)*/i ||
18
18
  auth[:openstack_tenant_id] || auth[:openstack_tenant]
19
- Fog::OpenStack::Auth::Token::V2.new(auth)
19
+ Fog::OpenStack::Auth::Token::V2.new(auth, options)
20
20
  else
21
- Fog::OpenStack::Auth::Token::V3.new(auth)
21
+ Fog::OpenStack::Auth::Token::V3.new(auth, options)
22
22
  end
23
23
  end
24
24
 
25
- def initialize(auth)
25
+ def initialize(auth, options)
26
26
  raise URLError, 'No URL provided' if auth[:openstack_auth_url].nil? || auth[:openstack_auth_url].empty?
27
27
  @creds = {
28
28
  :data => build_credentials(auth),
29
29
  :uri => URI.parse(auth[:openstack_auth_url])
30
30
  }
31
- response = authenticate(@creds)
31
+ response = authenticate(@creds, options)
32
32
  set(response)
33
33
  end
34
34
 
35
35
  def get
36
- set(authenticate(@creds)) if expired?
36
+ set(authenticate(@creds, {})) if expired?
37
37
  @token
38
38
  end
39
39
 
40
40
  private
41
41
 
42
- def authenticate(creds)
43
- connection_options = {}
44
- connection = Fog::Core::Connection.new(creds[:uri].to_s, false, connection_options)
42
+ def authenticate(creds, options)
43
+ connection = Fog::Core::Connection.new(creds[:uri].to_s, false, options)
45
44
 
46
45
  request = {
47
46
  :expects => [200, 201],
@@ -206,7 +206,7 @@ module Fog
206
206
  if !@openstack_management_url || @openstack_must_reauthenticate
207
207
  @openstack_auth_token = nil if @openstack_must_reauthenticate
208
208
 
209
- token = Fog::OpenStack::Auth::Token.build(openstack_options)
209
+ token = Fog::OpenStack::Auth::Token.build(openstack_options, @connection_options)
210
210
 
211
211
  @openstack_management_url = if token.catalog
212
212
  token.catalog.get_endpoint_url(
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module OpenStack
3
- VERSION = '0.3.3'.freeze
3
+ VERSION = '0.3.4'.freeze
4
4
  end
5
5
  end
@@ -13,7 +13,7 @@ describe Fog::OpenStack::Auth::Token do
13
13
  )
14
14
 
15
15
  proc do
16
- Fog::OpenStack::Auth::Token.build({})
16
+ Fog::OpenStack::Auth::Token.build({}, {})
17
17
  end.must_raise Fog::OpenStack::Auth::Token::URLError
18
18
  end
19
19
 
@@ -36,7 +36,7 @@ describe Fog::OpenStack::Auth::Token do
36
36
  :headers => {'x-subject-token'=>'token_data_v3'}
37
37
  )
38
38
 
39
- token = Fog::OpenStack::Auth::Token.build(auth)
39
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
40
40
  token.get.must_equal 'token_data_v3'
41
41
  end
42
42
 
@@ -59,7 +59,7 @@ describe Fog::OpenStack::Auth::Token do
59
59
  :headers => {'x-subject-token'=>'token_data'}
60
60
  )
61
61
 
62
- token = Fog::OpenStack::Auth::Token.build(auth)
62
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
63
63
  token.get.must_equal 'token_data'
64
64
  end
65
65
 
@@ -83,7 +83,7 @@ describe Fog::OpenStack::Auth::Token do
83
83
  :headers => {'x-subject-token'=>'token_data'}
84
84
  )
85
85
 
86
- token = Fog::OpenStack::Auth::Token.build(auth)
86
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
87
87
  token.get.must_equal 'token_data'
88
88
  end
89
89
  end
@@ -106,7 +106,7 @@ describe Fog::OpenStack::Auth::Token do
106
106
  :headers => {'x-subject-token'=>'token_data'}
107
107
  )
108
108
 
109
- token = Fog::OpenStack::Auth::Token.build(auth)
109
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
110
110
  token.get.must_equal 'token_data'
111
111
  end
112
112
 
@@ -127,7 +127,7 @@ describe Fog::OpenStack::Auth::Token do
127
127
  :headers => {'x-subject-token'=>'token_data'}
128
128
  )
129
129
 
130
- token = Fog::OpenStack::Auth::Token.build(auth)
130
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
131
131
  token.get.must_equal 'token_data'
132
132
  end
133
133
  end
@@ -149,7 +149,7 @@ describe Fog::OpenStack::Auth::Token do
149
149
  :headers => {'x-subject-token'=>'token_data'}
150
150
  )
151
151
 
152
- token = Fog::OpenStack::Auth::Token.build(auth)
152
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
153
153
  token.get.must_equal 'token_data'
154
154
  end
155
155
  end
@@ -171,7 +171,7 @@ describe Fog::OpenStack::Auth::Token do
171
171
  :headers => {'x-subject-token'=>'token_data'}
172
172
  )
173
173
 
174
- token = Fog::OpenStack::Auth::Token.build(auth)
174
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
175
175
  token.get.must_equal 'token_data'
176
176
  end
177
177
  end
@@ -193,7 +193,7 @@ describe Fog::OpenStack::Auth::Token do
193
193
  :headers => {'x-subject-token'=>'token_data'}
194
194
  )
195
195
 
196
- token = Fog::OpenStack::Auth::Token.build(auth)
196
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
197
197
  token.get.must_equal 'token_data'
198
198
  end
199
199
 
@@ -214,7 +214,7 @@ describe Fog::OpenStack::Auth::Token do
214
214
  :headers => {'x-subject-token'=>'token_data'}
215
215
  )
216
216
 
217
- token = Fog::OpenStack::Auth::Token.build(auth)
217
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
218
218
  token.get.must_equal 'token_data'
219
219
  end
220
220
  end
@@ -236,7 +236,7 @@ describe Fog::OpenStack::Auth::Token do
236
236
  :headers => {'x-subject-token'=>'token_data'}
237
237
  )
238
238
 
239
- token = Fog::OpenStack::Auth::Token.build(auth)
239
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
240
240
  token.get.must_equal 'token_data'
241
241
  end
242
242
 
@@ -256,7 +256,7 @@ describe Fog::OpenStack::Auth::Token do
256
256
  :headers => {'x-subject-token'=>'token_data'}
257
257
  )
258
258
 
259
- token = Fog::OpenStack::Auth::Token.build(auth)
259
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
260
260
  token.get.must_equal 'token_data'
261
261
  end
262
262
  end
@@ -283,7 +283,7 @@ describe Fog::OpenStack::Auth::Token do
283
283
  :headers => {'x-subject-token'=>'token_data'}
284
284
  )
285
285
 
286
- token = Fog::OpenStack::Auth::Token.build(authv3_creds)
286
+ token = Fog::OpenStack::Auth::Token.build(authv3_creds, {})
287
287
  token.stub :expired?, false do
288
288
  token.get.must_equal 'token_data'
289
289
  end
@@ -297,7 +297,7 @@ describe Fog::OpenStack::Auth::Token do
297
297
  :headers => {'x-subject-token'=>'token_data'}
298
298
  )
299
299
 
300
- token = Fog::OpenStack::Auth::Token.build(authv3_creds)
300
+ token = Fog::OpenStack::Auth::Token.build(authv3_creds, {})
301
301
  token.stub :expired?, true do
302
302
  token.get.must_equal 'token_data'
303
303
  end
@@ -312,7 +312,7 @@ describe Fog::OpenStack::Auth::Token do
312
312
  :headers => {'x-subject-token'=>'token_data'}
313
313
  )
314
314
 
315
- token = Fog::OpenStack::Auth::Token.build(authv3_creds)
315
+ token = Fog::OpenStack::Auth::Token.build(authv3_creds, {})
316
316
  token.catalog.payload.must_equal ['catalog_data']
317
317
  end
318
318
 
@@ -324,7 +324,7 @@ describe Fog::OpenStack::Auth::Token do
324
324
  :headers => {'x-subject-token'=>'token_data'}
325
325
  )
326
326
 
327
- token = Fog::OpenStack::Auth::Token.build(authv3_creds)
327
+ token = Fog::OpenStack::Auth::Token.build(authv3_creds, {})
328
328
  token.catalog.get_endpoint_url(%w[identity], 'public', 'regionOne').must_equal 'http://localhost'
329
329
  end
330
330
  end
@@ -337,7 +337,7 @@ describe Fog::OpenStack::Auth::Token do
337
337
  to_return(:status => 200, :body => "{\"access\":{\"token\":{\"id\":\"token_data\"}}}", :headers => {})
338
338
 
339
339
  proc do
340
- Fog::OpenStack::Auth::Token.build({})
340
+ Fog::OpenStack::Auth::Token.build({}, {})
341
341
  end.must_raise Fog::OpenStack::Auth::Token::URLError
342
342
  end
343
343
 
@@ -355,7 +355,7 @@ describe Fog::OpenStack::Auth::Token do
355
355
  \"tenantName\":\"tenant\"}}").
356
356
  to_return(:status => 200, :body => JSON.dump(auth_response_v2('identity', 'keystone')), :headers => {})
357
357
 
358
- token = Fog::OpenStack::Auth::Token.build(auth)
358
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
359
359
  token.get.must_equal '4ae647d3a5294690a3c29bc658e17e26'
360
360
  end
361
361
 
@@ -372,7 +372,7 @@ describe Fog::OpenStack::Auth::Token do
372
372
  \"tenantId\":\"tenant_id\"}}").
373
373
  to_return(:status => 200, :body => JSON.dump(auth_response_v2('identity', 'keystone')), :headers => {})
374
374
 
375
- token = Fog::OpenStack::Auth::Token.build(auth)
375
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
376
376
  token.get.must_equal '4ae647d3a5294690a3c29bc658e17e26'
377
377
  end
378
378
  end
@@ -389,7 +389,7 @@ describe Fog::OpenStack::Auth::Token do
389
389
  with(:body => "{\"auth\":{\"token\":{\"id\":\"token_id\"},\"tenantName\":\"tenant\"}}").
390
390
  to_return(:status => 200, :body => JSON.dump(auth_response_v2('identity', 'keystone')), :headers => {})
391
391
 
392
- token = Fog::OpenStack::Auth::Token.build(auth)
392
+ token = Fog::OpenStack::Auth::Token.build(auth, {})
393
393
  token.get.must_equal '4ae647d3a5294690a3c29bc658e17e26'
394
394
  end
395
395
 
@@ -404,7 +404,7 @@ describe Fog::OpenStack::Auth::Token do
404
404
  with(:body => "{\"auth\":{\"token\":{\"id\":\"token_id\"},\"tenantId\":\"tenant_id\"}}").
405
405
  to_return(:status => 200, :body => JSON.dump(auth_response_v2('identity', 'keystone')), :headers => {})
406
406
 
407
- Fog::OpenStack::Auth::Token.build(auth)
407
+ Fog::OpenStack::Auth::Token.build(auth, {})
408
408
  end
409
409
  end
410
410
  end
@@ -429,7 +429,7 @@ describe Fog::OpenStack::Auth::Token do
429
429
  :headers => {}
430
430
  )
431
431
 
432
- token = Fog::OpenStack::Auth::Token.build(authv2_creds)
432
+ token = Fog::OpenStack::Auth::Token.build(authv2_creds, {})
433
433
  token.stub :expired?, false do
434
434
  token.get.must_equal 'token_not_expired'
435
435
  end
@@ -443,7 +443,7 @@ describe Fog::OpenStack::Auth::Token do
443
443
  :headers => {}
444
444
  )
445
445
 
446
- token = Fog::OpenStack::Auth::Token.build(authv2_creds)
446
+ token = Fog::OpenStack::Auth::Token.build(authv2_creds, {})
447
447
  token.stub :expired?, true do
448
448
  token.get.must_equal 'token_expired'
449
449
  end
@@ -458,7 +458,7 @@ describe Fog::OpenStack::Auth::Token do
458
458
  :headers => {}
459
459
  )
460
460
 
461
- token = Fog::OpenStack::Auth::Token.build(authv2_creds)
461
+ token = Fog::OpenStack::Auth::Token.build(authv2_creds, {})
462
462
  token.catalog.payload.must_equal ['catalog_data']
463
463
  end
464
464
 
@@ -470,7 +470,7 @@ describe Fog::OpenStack::Auth::Token do
470
470
  :headers => {'x-subject-token'=>'token_data'}
471
471
  )
472
472
 
473
- token = Fog::OpenStack::Auth::Token.build(authv2_creds)
473
+ token = Fog::OpenStack::Auth::Token.build(authv2_creds, {})
474
474
  token.catalog.get_endpoint_url(%w[identity], 'public', 'regionOne').must_equal 'http://localhost'
475
475
  end
476
476
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-25 00:00:00.000000000 Z
11
+ date: 2018-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core