swift-storage 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/swift_storage/configuration.rb +2 -1
- data/lib/swift_storage/service.rb +17 -3
- data/lib/swift_storage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da14f122449c3a28046bdde2a55627d9786063b5
|
4
|
+
data.tar.gz: 7c3d4bbdb737640d475d0d5f23c9749db619abb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 445875d4a6c9b8a2bae8723ee8f181a8bf07bc4ad6fe81d6229ca6d69c756a12e893a1580c3a0069f899e6ef7428865d644f29c604b8dbe34c0ab4a03ff8b24b
|
7
|
+
data.tar.gz: 472938b6204624e0ba9797b150f39025ce56a625d2f3e94be781ca51e8f2cbef7f568591c96a0dc123ba212001749b7701cfbc33c4e1d68d26231ac978070670
|
data/CHANGELOG.md
CHANGED
@@ -3,10 +3,16 @@
|
|
3
3
|
This file is written in reverse chronological order, newer releases will
|
4
4
|
appear at the top.
|
5
5
|
|
6
|
+
## 0.0.10
|
7
|
+
|
8
|
+
* Retry on connection error before giving up
|
9
|
+
[#11](https://github.com/memoways/swift-ruby/pull/11)
|
10
|
+
@ArmandPredicSis
|
11
|
+
|
6
12
|
## 0.0.9
|
7
13
|
|
8
14
|
* Allow upload of large file (>5GB)
|
9
|
-
[#
|
15
|
+
[#10](https://github.com/memoways/swift-ruby/pull/10)
|
10
16
|
@ArmandPredicSis
|
11
17
|
|
12
18
|
## 0.0.8
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module SwiftStorage
|
2
2
|
class Configuration
|
3
3
|
attr_accessor :auth_version, :tenant, :username, :password, :endpoint, :temp_url_key,
|
4
|
-
:auth_method, :authtenant_type
|
4
|
+
:auth_method, :authtenant_type, :retries
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@auth_version = ENV['SWIFT_STORAGE_AUTH_VERSION'] || '1.0'
|
@@ -10,6 +10,7 @@ module SwiftStorage
|
|
10
10
|
@password = ENV['SWIFT_STORAGE_PASSWORD']
|
11
11
|
@endpoint = ENV['SWIFT_STORAGE_ENDPOINT']
|
12
12
|
@temp_url_key = ENV['SWIFT_STORAGE_TEMP_URL_KEY']
|
13
|
+
@retries = 3
|
13
14
|
|
14
15
|
@auth_method = :password
|
15
16
|
@authtenant_type = 'tenantName' # `tenantName` or `tenantId`
|
@@ -20,14 +20,17 @@ class SwiftStorage::Service
|
|
20
20
|
:storage_host,
|
21
21
|
:storage_port,
|
22
22
|
:storage_path,
|
23
|
-
:temp_url_key
|
23
|
+
:temp_url_key,
|
24
|
+
:retries
|
24
25
|
|
25
26
|
def initialize(tenant: configuration.tenant,
|
26
27
|
username: configuration.username,
|
27
28
|
password: configuration.password,
|
28
29
|
endpoint: configuration.endpoint,
|
29
|
-
temp_url_key: configuration.temp_url_key
|
30
|
+
temp_url_key: configuration.temp_url_key,
|
31
|
+
retries: configuration.retries)
|
30
32
|
@temp_url_key = temp_url_key
|
33
|
+
@retries = retries
|
31
34
|
|
32
35
|
%w(tenant username password endpoint).each do |n|
|
33
36
|
eval("#{n} or raise ArgumentError, '#{n} is required'")
|
@@ -116,6 +119,9 @@ class SwiftStorage::Service
|
|
116
119
|
json_data: nil,
|
117
120
|
input_stream: nil,
|
118
121
|
output_stream: nil)
|
122
|
+
|
123
|
+
tries = retries
|
124
|
+
|
119
125
|
headers ||= {}
|
120
126
|
headers.merge!(Headers::AUTH_TOKEN => auth_token) if authenticated?
|
121
127
|
headers.merge!(Headers::CONTENT_TYPE => 'application/json') if json_data
|
@@ -183,7 +189,15 @@ class SwiftStorage::Service
|
|
183
189
|
end
|
184
190
|
end
|
185
191
|
|
186
|
-
|
192
|
+
begin
|
193
|
+
response = s.request(req, &output_proc)
|
194
|
+
rescue Errno::EPIPE, Errno::EAGAIN, Errno::EWOULDBLOCK, Timeout::Error, Errno::EINVAL, EOFError
|
195
|
+
# Server closed the connection, retry
|
196
|
+
sleep 5
|
197
|
+
retry unless (tries -= 1) <= 0
|
198
|
+
raise OpenStack::Exception::Connection, "Unable to connect to OpenStack::Swift after #{retries} retries"
|
199
|
+
end
|
200
|
+
|
187
201
|
begin
|
188
202
|
check_response!(response)
|
189
203
|
rescue AuthError
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swift-storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Goy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|