openstack 3.3.20 → 3.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/VERSION +1 -1
- data/lib/openstack/connection.rb +20 -13
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 46a9c965563f1fa6e8adcf4a04a6a0c59a5b53424be6728148cf27daac9eeb58
|
4
|
+
data.tar.gz: ce173fe173885f4257fca464603fc6349253b35d4216686eb14c1fbe98140fe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d04758eb38abdec9ce355de00ee0726d5279268669ceb9a63f5d1b4db565b84d5c919bb8e24cf3afcd924cfddf3624f4bf6448fcdb2a7dc4788406aae36b97a
|
7
|
+
data.tar.gz: b011b062002c5f6e42bf69cd0b498bf805cb99e926542926b7d31ae3d025ad7b1bbe93c7921190d35495cd5994d2c1be6463246197db0c302cffcb509c12906f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.21
|
data/lib/openstack/connection.rb
CHANGED
@@ -36,10 +36,12 @@ class Connection
|
|
36
36
|
attr_reader :ssl_version
|
37
37
|
attr_reader :region
|
38
38
|
attr_reader :regions_list #e.g. os.connection.regions_list == {"region-a.geo-1" => [ {:service=>"object-store", :versionId=>"1.0"}, {:service=>"identity", :versionId=>"2.0"}], "region-b.geo-1"=>[{:service=>"identity", :versionId=>"2.0"}] }
|
39
|
+
attr_reader :force_https
|
39
40
|
|
40
41
|
attr_reader :http
|
41
42
|
attr_reader :is_debug
|
42
43
|
attr_reader :endpoint_type
|
44
|
+
attr_reader :random_endpoint
|
43
45
|
|
44
46
|
# Creates and returns a new Connection object, depending on the service_type
|
45
47
|
# passed in the options:
|
@@ -78,6 +80,9 @@ class Connection
|
|
78
80
|
# :ssl_version - explicitly set an version (:SSLv3 etc, see OpenSSL::SSL::SSLContext::METHODS)
|
79
81
|
# :is_debug - Only for development purpose for debug output
|
80
82
|
# :endpoint_type - Type of endpoint. Optional. 'publicURL', 'internalURL', 'adminURL'
|
83
|
+
# :random_endpoint - (Optional for v3.0 auth only). Select random endpoint from the list provided by the
|
84
|
+
# auth endpoint to distribute load between endpoints. Defaults to false
|
85
|
+
# :force_https - Force HTTPS for all connections.
|
81
86
|
#
|
82
87
|
# The options hash is used to create a new OpenStack::Connection object
|
83
88
|
# (private constructor) and this is passed to the constructor of OpenStack::Compute::Connection
|
@@ -139,7 +144,7 @@ class Connection
|
|
139
144
|
raise Exception::InvalidArgument, "Invalid :auth_url parameter." if auth_uri.nil? or auth_uri.host.nil?
|
140
145
|
@auth_host = auth_uri.host
|
141
146
|
@auth_port = auth_uri.port
|
142
|
-
@auth_scheme = auth_uri.scheme
|
147
|
+
@auth_scheme = options[:force_https] ? 'https' : auth_uri.scheme
|
143
148
|
@auth_path = auth_uri.path
|
144
149
|
@retry_auth = options[:retry_auth]
|
145
150
|
@proxy_host = options[:proxy_host]
|
@@ -151,6 +156,8 @@ class Connection
|
|
151
156
|
@quantum_version = 'v2.0' if @service_type == 'network'
|
152
157
|
@quantum_version = 'v2' if @service_type == 'metering'
|
153
158
|
@endpoint_type = options[:endpoint_type] || "publicURL"
|
159
|
+
@random_endpoint = options[:random_endpoint] || false
|
160
|
+
@force_https = options[:force_https] || false
|
154
161
|
@semaphore = Mutex.new
|
155
162
|
end
|
156
163
|
|
@@ -365,7 +372,7 @@ class Connection
|
|
365
372
|
puts "Can't connect to the server: #{tries} tries to reconnect" if connection.is_debug
|
366
373
|
sleep time += 1
|
367
374
|
retry unless (tries -= 1) <= 0
|
368
|
-
raise OpenStack::Exception::Connection, "Unable to connect to #{
|
375
|
+
raise OpenStack::Exception::Connection, "Unable to connect to #{connection.proxy_host}"
|
369
376
|
end
|
370
377
|
|
371
378
|
response = server.get(connection.auth_path, hdrhash)
|
@@ -382,7 +389,7 @@ class Connection
|
|
382
389
|
connection.service_host = uri.host
|
383
390
|
connection.service_path = uri.path
|
384
391
|
connection.service_port = uri.port
|
385
|
-
connection.service_scheme = uri.scheme
|
392
|
+
connection.service_scheme = connection.force_https ? 'https' : uri.scheme
|
386
393
|
connection.authok = true
|
387
394
|
else
|
388
395
|
connection.authok = false
|
@@ -420,7 +427,7 @@ class Connection
|
|
420
427
|
puts "Can't connect to the server: #{tries} tries to reconnect" if connection.is_debug
|
421
428
|
sleep time += 1
|
422
429
|
retry unless (tries -= 1) <= 0
|
423
|
-
raise OpenStack::Exception::Connection, "Unable to connect to #{
|
430
|
+
raise OpenStack::Exception::Connection, "Unable to connect to #{connection.proxy_host}"
|
424
431
|
end
|
425
432
|
|
426
433
|
@uri = String.new
|
@@ -478,7 +485,7 @@ class Connection
|
|
478
485
|
connection.service_host = @uri.host
|
479
486
|
connection.service_path = @uri.path
|
480
487
|
connection.service_port = @uri.port
|
481
|
-
connection.service_scheme = @uri.scheme
|
488
|
+
connection.service_scheme = connection.force_https ? 'https' : @uri.scheme
|
482
489
|
connection.authok = true
|
483
490
|
end
|
484
491
|
end
|
@@ -532,7 +539,7 @@ class Connection
|
|
532
539
|
puts "Can't connect to the server: #{tries} tries to reconnect" if connection.is_debug
|
533
540
|
sleep time += 1
|
534
541
|
retry unless (tries -= 1) <= 0
|
535
|
-
raise OpenStack::Exception::Connection, "Unable to connect to #{
|
542
|
+
raise OpenStack::Exception::Connection, "Unable to connect to #{connection.proxy_host}"
|
536
543
|
end
|
537
544
|
|
538
545
|
# Build Auth JSON
|
@@ -614,13 +621,13 @@ class Connection
|
|
614
621
|
interface_type = connection.endpoint_type.gsub('URL','')
|
615
622
|
endpoints = endpoints.select {|ep| ep['interface'] == interface_type}
|
616
623
|
|
617
|
-
#
|
624
|
+
# filter endpoints by region
|
618
625
|
if connection.region
|
619
|
-
endpoints.
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
626
|
+
endpoints = endpoints.select {|ep| ep["region"] and ep["region"].upcase == connection.region.upcase}
|
627
|
+
end
|
628
|
+
|
629
|
+
if connection.random_endpoint
|
630
|
+
@uri = URI.parse(endpoints.sample['url'])
|
624
631
|
else
|
625
632
|
@uri = URI.parse(endpoints[0]['url'])
|
626
633
|
end
|
@@ -631,7 +638,7 @@ class Connection
|
|
631
638
|
connection.service_host = @uri.host
|
632
639
|
connection.service_path = @uri.path
|
633
640
|
connection.service_port = @uri.port
|
634
|
-
connection.service_scheme = @uri.scheme
|
641
|
+
connection.service_scheme = connection.force_https ? 'https' : @uri.scheme
|
635
642
|
connection.authok = true
|
636
643
|
end
|
637
644
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Prince
|
@@ -137,8 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
|
-
|
141
|
-
rubygems_version: 2.6.14.1
|
140
|
+
rubygems_version: 3.0.3
|
142
141
|
signing_key:
|
143
142
|
specification_version: 4
|
144
143
|
summary: OpenStack Ruby API
|