fog-openstack 1.0.1 → 1.0.2

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: abb817399bc80ba516784a9a377b5deaec69a7c3
4
- data.tar.gz: a56c91075e1400e259cb38841e3eed0246469718
3
+ metadata.gz: ea0e7a81cd4d076ed16a5cab127a5ab730881d3e
4
+ data.tar.gz: 5128d367de9376015965157fbc610040b11be008
5
5
  SHA512:
6
- metadata.gz: d1f94ba6d952af85df598963158c16e2623ff8ad081e7d4198198f58e0496fa13583603b189683f7ec1ff6480b24ac4197ee38dca044ae0dee6e0fee8bc77f24
7
- data.tar.gz: a581bdc68d1785c65f10139839688fad5b69e1d352a84df8e8836a2e50525278bf034531ad2854d111fcdd1a55693e1b01bef46d58e80e1c6c1cb2955b1fab0a
6
+ metadata.gz: 25784e5390b52943bfb2af9b0e99dc4f53a5fc1d443d7fa82b4677a4a8bb0c321078cb5c9e184d6033fc7e1737bd5b9c61cbf7d9ad2914d4e34b06a0636bf276
7
+ data.tar.gz: 222a1f8668c1b81c5be08e5264cc956e61f9a46efecf96635efa5258ee325971fc46647a695acfc04132991b5af1813f70bd769b67b3cbed2b9436fb3a02df5b
@@ -5,26 +5,7 @@ module Fog
5
5
  autoload :V3, 'fog/openstack/identity/v3'
6
6
 
7
7
  def self.new(args = {})
8
- version = if args[:openstack_identity_api_version] =~ /(v)*2(\.0)*/i
9
- '2.0'
10
- elsif args[:openstack_auth_url] =~ /v3|v2(\.0)*/
11
- # Deprecated from fog-openstack 0.2.0
12
- # Will be removed in future after hard deprecation is enforced for a couple of releases
13
- Fog::Logger.deprecation("An authentication URL including a version is deprecated")
14
- case args[:openstack_auth_url]
15
- when /\/v3(\/)*.*$/
16
- args[:openstack_auth_url].gsub!(/\/v3(\/)*.*$/, '')
17
- args[:no_path_prefix] = true
18
- '3'
19
- when /\/v2(\.0)*(\/)*.*$/
20
- args[:openstack_auth_url].gsub!(/\/v2(\.0)*(\/)*.*$/, '')
21
- args[:no_path_prefix] = true
22
- '2.0'
23
- end
24
- end
25
-
26
- case version
27
- when '2.0'
8
+ if args[:openstack_identity_api_version] =~ /(v)*2(\.0)*/i
28
9
  Fog::OpenStack::Identity::V2.new(args)
29
10
  else
30
11
  Fog::OpenStack::Identity::V3.new(args)
@@ -169,12 +169,8 @@ module Fog
169
169
  end
170
170
 
171
171
  class Real < Fog::OpenStack::Identity::Real
172
- def initialize(args)
173
- @path_prefix = if args[:no_path_prefix]
174
- ''
175
- else
176
- 'v2.0'
177
- end
172
+ def api_path_prefix
173
+ @path_prefix = version_in_path?(@openstack_management_uri.path) ? '' : 'v2.0'
178
174
  super
179
175
  end
180
176
 
@@ -185,6 +181,10 @@ module Fog
185
181
  def default_service_type
186
182
  %w[identity_v2 identityv2 identity]
187
183
  end
184
+
185
+ def version_in_path?(url)
186
+ true if url =~ /\/v2(\.0)*(\/)*.*$/
187
+ end
188
188
  end
189
189
  end
190
190
  end
@@ -13,7 +13,7 @@ module Fog
13
13
  :openstack_user_domain_id, :openstack_project_domain_id,
14
14
  :openstack_api_key, :openstack_current_user_id, :openstack_userid, :openstack_username,
15
15
  :current_user, :current_user_id, :current_tenant,
16
- :provider, :openstack_identity_api_version, :openstack_cache_ttl, :no_path_prefix
16
+ :provider, :openstack_identity_api_version, :openstack_cache_ttl
17
17
 
18
18
  model_path 'fog/openstack/identity/v3/models'
19
19
  model :domain
@@ -142,12 +142,8 @@ module Fog
142
142
  end
143
143
 
144
144
  class Real < Fog::OpenStack::Identity::Real
145
- def initialize(args)
146
- @path_prefix = if args[:no_path_prefix]
147
- ''
148
- else
149
- 'v3'
150
- end
145
+ def api_path_prefix
146
+ @path_prefix = version_in_path?(@openstack_management_uri.path) ? '' : 'v3'
151
147
  super
152
148
  end
153
149
 
@@ -158,6 +154,10 @@ module Fog
158
154
  def default_service_type
159
155
  %w[identity_v3 identityv3 identity]
160
156
  end
157
+
158
+ def version_in_path?(url)
159
+ true if url =~ /\/v3(\/)*.*$/
160
+ end
161
161
  end
162
162
  end
163
163
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module OpenStack
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.0.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby