uricp 0.0.15 → 0.0.16
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 +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -8
- data/Jenkinsfile +27 -0
- data/Rakefile +19 -36
- data/bionic/Dockerfile +2 -2
- data/centos7/Dockerfile +2 -2
- data/features/step_definitions/orbit_steps.rb +11 -4
- data/lib/segment_upload.rb +20 -22
- data/lib/uricp.rb +3 -3
- data/lib/uricp/curl_primitives.rb +31 -33
- data/lib/uricp/orbit_auth.rb +23 -27
- data/lib/uricp/segmenter.rb +12 -16
- data/lib/uricp/strategy/cache_common.rb +11 -11
- data/lib/uricp/strategy/cached_get.rb +14 -20
- data/lib/uricp/strategy/cleaner.rb +2 -8
- data/lib/uricp/strategy/common.rb +25 -18
- data/lib/uricp/strategy/local_convert.rb +9 -16
- data/lib/uricp/strategy/local_link.rb +10 -8
- data/lib/uricp/strategy/piped_cache.rb +7 -13
- data/lib/uricp/strategy/piped_cache_convert.rb +14 -18
- data/lib/uricp/strategy/piped_compress.rb +3 -8
- data/lib/uricp/strategy/piped_decompress.rb +7 -11
- data/lib/uricp/strategy/piped_local_compress.rb +0 -4
- data/lib/uricp/strategy/piped_local_decompress.rb +10 -16
- data/lib/uricp/strategy/piped_local_get.rb +0 -5
- data/lib/uricp/strategy/piped_local_put.rb +3 -9
- data/lib/uricp/strategy/piped_rbd_get.rb +44 -0
- data/lib/uricp/strategy/piped_remote_get.rb +20 -20
- data/lib/uricp/strategy/rbd_remote_put.rb +36 -0
- data/lib/uricp/strategy/rbd_sweeper.rb +22 -0
- data/lib/uricp/strategy/remote_put.rb +11 -17
- data/lib/uricp/strategy/segmented_remote_put.rb +16 -28
- data/lib/uricp/strategy/sweeper.rb +2 -8
- data/lib/uricp/uri_strategy.rb +14 -13
- data/lib/uricp/version.rb +2 -2
- data/trusty/Dockerfile +2 -2
- data/uricp.gemspec +0 -1
- data/xenial/Dockerfile +2 -2
- metadata +7 -20
- data/spec/something_spec.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7db104674249fa9443799b004c877667e22b142d26a7c7a2220ef668865dfbc
|
4
|
+
data.tar.gz: d333e085bb1b666e09883fbd9b9006334d6c15acd17ac781629697bcc0766e5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e16104719cca1e2def15b5d9b2d7cbdbcb84b68f7d69a566b8eddd64e699654ea72f066102bb8949e2eb583ffd54aad9549b5094746747382930cf18a1de5a8
|
7
|
+
data.tar.gz: b0f839f96f8975ce95121085fdba25ecb1451fc38dbc975de250a6277ffe584a5548f6033138cb46ae8f200a0e6c063e45b2eb25b26ea4e6cefad0d592b91294
|
data/.rubocop.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
uricp (0.0.
|
4
|
+
uricp (0.0.16)
|
5
5
|
filesize (= 0.0.2)
|
6
6
|
methadone (~> 2.0.0)
|
7
7
|
open4 (~> 1.3.0)
|
@@ -38,14 +38,8 @@ GEM
|
|
38
38
|
rake (10.4.2)
|
39
39
|
rdoc (4.2.2)
|
40
40
|
json (~> 1.4)
|
41
|
-
rspec (2.99.0)
|
42
|
-
rspec-core (~> 2.99.0)
|
43
|
-
rspec-expectations (~> 2.99.0)
|
44
|
-
rspec-mocks (~> 2.99.0)
|
45
|
-
rspec-core (2.99.2)
|
46
41
|
rspec-expectations (2.99.2)
|
47
42
|
diff-lcs (>= 1.1.3, < 2.0)
|
48
|
-
rspec-mocks (2.99.4)
|
49
43
|
sendfile (1.2.2)
|
50
44
|
|
51
45
|
PLATFORMS
|
@@ -58,7 +52,6 @@ DEPENDENCIES
|
|
58
52
|
inifile (~> 1.1)
|
59
53
|
rake (~> 10.4.0)
|
60
54
|
rdoc (~> 4.2.0)
|
61
|
-
rspec (~> 2.99)
|
62
55
|
uricp!
|
63
56
|
|
64
57
|
BUNDLED WITH
|
data/Jenkinsfile
CHANGED
@@ -29,6 +29,11 @@ pipeline {
|
|
29
29
|
always {
|
30
30
|
sh 'bundle exec rake features:clean'
|
31
31
|
}
|
32
|
+
failure {
|
33
|
+
mail to: 'sysadmin@brightbox.co.uk',
|
34
|
+
subject: "Uricp Tests Failed: ${currentBuild.fullDisplayName}",
|
35
|
+
body: "${env.BUILD_URL}"
|
36
|
+
}
|
32
37
|
}
|
33
38
|
}
|
34
39
|
stage("Trusty, Ruby 1.9.3") {
|
@@ -46,6 +51,11 @@ pipeline {
|
|
46
51
|
always {
|
47
52
|
sh 'bundle exec rake features:clean'
|
48
53
|
}
|
54
|
+
failure {
|
55
|
+
mail to: 'sysadmin@brightbox.co.uk',
|
56
|
+
subject: "Uricp Tests Failed: ${currentBuild.fullDisplayName}",
|
57
|
+
body: "${env.BUILD_URL}"
|
58
|
+
}
|
49
59
|
}
|
50
60
|
}
|
51
61
|
stage("Xenial, Ruby 2.3.1") {
|
@@ -63,6 +73,11 @@ pipeline {
|
|
63
73
|
always {
|
64
74
|
sh 'bundle exec rake features:clean'
|
65
75
|
}
|
76
|
+
failure {
|
77
|
+
mail to: 'sysadmin@brightbox.co.uk',
|
78
|
+
subject: "Uricp Tests Failed: ${currentBuild.fullDisplayName}",
|
79
|
+
body: "${env.BUILD_URL}"
|
80
|
+
}
|
66
81
|
}
|
67
82
|
}
|
68
83
|
stage("Bionic, Ruby 2.5.1") {
|
@@ -80,7 +95,19 @@ pipeline {
|
|
80
95
|
always {
|
81
96
|
sh 'bundle exec rake features:clean'
|
82
97
|
}
|
98
|
+
failure {
|
99
|
+
mail to: 'sysadmin@brightbox.co.uk',
|
100
|
+
subject: "Uricp Tests Failed: ${currentBuild.fullDisplayName}",
|
101
|
+
body: "${env.BUILD_URL}"
|
102
|
+
}
|
83
103
|
}
|
84
104
|
}
|
85
105
|
}
|
106
|
+
post {
|
107
|
+
failure {
|
108
|
+
mail to: 'sysadmin@brightbox.co.uk',
|
109
|
+
subject: "Uricp Tests Failed: ${currentBuild.fullDisplayName}",
|
110
|
+
body: "${env.BUILD_URL}"
|
111
|
+
}
|
112
|
+
}
|
86
113
|
}
|
data/Rakefile
CHANGED
@@ -2,19 +2,19 @@ def dump_load_path
|
|
2
2
|
puts $LOAD_PATH.join("\n")
|
3
3
|
found = nil
|
4
4
|
$LOAD_PATH.each do |path|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
puts "!! no rake_task"
|
14
|
-
end
|
5
|
+
next unless File.exist?(File.join(path, 'rspec'))
|
6
|
+
|
7
|
+
puts "Found rspec in #{path}"
|
8
|
+
if File.exist?(File.join(path, 'rspec', 'core'))
|
9
|
+
puts 'Found core'
|
10
|
+
if File.exist?(File.join(path, 'rspec', 'core', 'rake_task'))
|
11
|
+
puts 'Found rake_task'
|
12
|
+
found = path
|
15
13
|
else
|
16
|
-
puts
|
14
|
+
puts '!! no rake_task'
|
17
15
|
end
|
16
|
+
else
|
17
|
+
puts '!!! no core'
|
18
18
|
end
|
19
19
|
end
|
20
20
|
if found.nil?
|
@@ -26,13 +26,6 @@ end
|
|
26
26
|
require 'bundler'
|
27
27
|
require 'rake/clean'
|
28
28
|
|
29
|
-
begin
|
30
|
-
require 'rspec/core/rake_task'
|
31
|
-
rescue LoadError
|
32
|
-
dump_load_path
|
33
|
-
raise
|
34
|
-
end
|
35
|
-
|
36
29
|
require 'cucumber'
|
37
30
|
require 'cucumber/rake/task'
|
38
31
|
gem 'rdoc' # we need the installed RDoc gem, not the system one
|
@@ -42,13 +35,7 @@ include Rake::DSL
|
|
42
35
|
|
43
36
|
Bundler::GemHelper.install_tasks
|
44
37
|
|
45
|
-
|
46
|
-
RSpec::Core::RakeTask.new do |t|
|
47
|
-
# Put spec opts in a file named .rspec in root
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
CUKE_RESULTS = 'results.html'
|
38
|
+
CUKE_RESULTS = 'results.html'.freeze
|
52
39
|
CLEAN << CUKE_RESULTS
|
53
40
|
namespace(:features) do
|
54
41
|
Cucumber::Rake::Task.new(:new_qemu) do |t|
|
@@ -64,11 +51,9 @@ namespace(:features) do
|
|
64
51
|
|
65
52
|
task(:clean) do
|
66
53
|
if ENV['ORBIT_USER'] && ENV['ORBIT_KEY']
|
67
|
-
%w
|
68
|
-
sh "swift --quiet --insecure -A #{ENV['ORBIT_URL'] ||
|
69
|
-
|
70
|
-
puts "Delete failed: #{res.exitstatus}"
|
71
|
-
end
|
54
|
+
%w[temp_dlo test_upload].each do |test_file|
|
55
|
+
sh "swift --quiet --insecure -A #{ENV['ORBIT_URL'] || 'https://orbit.gb1.brightbox.com/v1'} -U #{ENV['ORBIT_USER']} -K #{ENV['ORBIT_KEY']} delete #{test_file}" do |ok, res|
|
56
|
+
puts "Delete failed: #{res.exitstatus}" unless ok
|
72
57
|
end
|
73
58
|
end
|
74
59
|
end
|
@@ -76,11 +61,9 @@ namespace(:features) do
|
|
76
61
|
end
|
77
62
|
|
78
63
|
Rake::RDocTask.new do |rd|
|
79
|
-
|
80
|
-
rd.main = "README.rdoc"
|
81
|
-
|
82
|
-
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
83
|
-
end
|
64
|
+
rd.main = 'README.rdoc'
|
84
65
|
|
85
|
-
|
66
|
+
rd.rdoc_files.include('README.rdoc', 'lib/**/*.rb', 'bin/**/*')
|
67
|
+
end
|
86
68
|
|
69
|
+
task default: [:spec, 'features:new_qemu']
|
data/bionic/Dockerfile
CHANGED
@@ -13,8 +13,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \
|
|
13
13
|
curl \
|
14
14
|
ruby \
|
15
15
|
ruby-dev \
|
16
|
-
python-swiftclient
|
16
|
+
python-swiftclient \
|
17
|
+
ruby-bundler
|
17
18
|
|
18
19
|
RUN echo "gem: --no-ri --no-rdoc" >> "$HOME/.gemrc"
|
19
|
-
RUN gem install bundler
|
20
20
|
|
data/centos7/Dockerfile
CHANGED
@@ -8,7 +8,8 @@ RUN yum update -y && yum -y install \
|
|
8
8
|
git \
|
9
9
|
qemu-img \
|
10
10
|
ruby-devel \
|
11
|
-
rubygems
|
11
|
+
rubygems \
|
12
|
+
rubygem-bundler
|
12
13
|
|
13
14
|
RUN yum -y install python-setuptools && \
|
14
15
|
easy_install pip && \
|
@@ -16,5 +17,4 @@ RUN yum -y install python-setuptools && \
|
|
16
17
|
pip install python-swiftclient
|
17
18
|
|
18
19
|
RUN echo "gem: --no-ri --no-rdoc" >> "$HOME/.gemrc"
|
19
|
-
RUN gem install bundler
|
20
20
|
|
@@ -18,12 +18,19 @@ def fetch_orbit_token
|
|
18
18
|
@current_url_target = ENV['ORBIT_URL'] || 'https://orbit.brightbox.com/v1'
|
19
19
|
cmd = "curl -I #{@current_url_target} -H 'X-Auth-User: #{@clientid}' -H 'X-Auth-Key: #{@key}'"
|
20
20
|
run_simple(unescape(cmd))
|
21
|
-
stdout_from(cmd)
|
21
|
+
output = stdout_from(cmd)
|
22
|
+
output.each_line do |line|
|
22
23
|
key, value = line.strip.split(/\s*:\s*/,2)
|
23
|
-
|
24
|
-
|
24
|
+
case key.to_s.downcase
|
25
|
+
when 'x-auth-token'
|
26
|
+
@current_auth_token = value
|
27
|
+
when 'x-storage-url'
|
28
|
+
@current_storage_url = value
|
29
|
+
end
|
30
|
+
end
|
31
|
+
unless @current_auth_token && @current_storage_url
|
32
|
+
raise(RuntimeError, "Credentials not accepted. Can't obtain auth token for tests.\n#{output}")
|
25
33
|
end
|
26
|
-
raise(RuntimeError, "Credentials not accepted. Can't obtain auth token for tests.") unless @current_auth_token && @current_storage_url
|
27
34
|
end
|
28
35
|
|
29
36
|
def create_download_file(filetype, name, container)
|
data/lib/segment_upload.rb
CHANGED
@@ -1,36 +1,34 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'uricp/version'
|
2
|
+
require 'uricp/curl_primitives'
|
3
|
+
require 'uricp/orbit_auth'
|
4
|
+
require 'uricp/segmenter'
|
5
5
|
|
6
6
|
module Uricp
|
7
|
-
|
8
7
|
UnsupportedURLtype = Class.new(ArgumentError)
|
9
|
-
|
10
8
|
end
|
11
9
|
|
12
|
-
#Monkey patch a copy_stream facility in using 'sendfile'
|
10
|
+
# Monkey patch a copy_stream facility in using 'sendfile'
|
13
11
|
unless IO.respond_to? :copy_stream
|
14
12
|
require 'sendfile'
|
15
13
|
|
16
|
-
def IO.copy_stream(src, dst, copy_length=nil, offset=nil)
|
17
|
-
|
18
|
-
current_pos = src.pos
|
19
|
-
count = dst.sendfile(src, offset || current_pos, copy_length)
|
20
|
-
src.seek(count, IO::SEEK_CUR)
|
21
|
-
return count
|
22
|
-
else
|
14
|
+
def IO.copy_stream(src, dst, copy_length = nil, offset = nil)
|
15
|
+
if src.stat.pipe?
|
23
16
|
amount = copy_length.to_i
|
24
17
|
buf_size = [amount, 2**16].min
|
25
|
-
buffer=
|
26
|
-
while amount > 0
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
18
|
+
buffer = ''
|
19
|
+
while amount > 0
|
20
|
+
src.read(buf_size, buffer)
|
21
|
+
amount_read = buffer.length
|
22
|
+
dst.write(buffer)
|
23
|
+
amount -= amount_read
|
24
|
+
break if src.eof?
|
32
25
|
end
|
33
|
-
|
26
|
+
copy_length.to_i - amount
|
27
|
+
else
|
28
|
+
current_pos = src.pos
|
29
|
+
count = dst.sendfile(src, offset || current_pos, copy_length)
|
30
|
+
src.seek(count, IO::SEEK_CUR)
|
31
|
+
count
|
34
32
|
end
|
35
33
|
rescue EOFError
|
36
34
|
0
|
data/lib/uricp.rb
CHANGED
@@ -7,26 +7,26 @@ require 'uricp/strategy/local_link'
|
|
7
7
|
require 'uricp/strategy/piped_cache'
|
8
8
|
require 'uricp/strategy/piped_cache_convert'
|
9
9
|
require 'uricp/strategy/piped_local_get'
|
10
|
+
require 'uricp/strategy/piped_rbd_get'
|
10
11
|
require 'uricp/strategy/piped_local_put'
|
11
12
|
require 'uricp/strategy/piped_remote_get'
|
12
13
|
require 'uricp/strategy/piped_compress'
|
13
14
|
require 'uricp/strategy/piped_decompress'
|
14
15
|
require 'uricp/strategy/piped_local_decompress'
|
15
16
|
require 'uricp/strategy/piped_local_compress'
|
17
|
+
require 'uricp/strategy/rbd_remote_put'
|
16
18
|
require 'uricp/strategy/segmented_remote_put'
|
17
19
|
require 'uricp/strategy/remote_put'
|
18
20
|
require 'uricp/strategy/cached_get'
|
21
|
+
require 'uricp/strategy/rbd_sweeper'
|
19
22
|
require 'uricp/strategy/sweeper'
|
20
23
|
require 'uricp/strategy/cleaner'
|
21
24
|
require 'uricp/uri_strategy'
|
22
25
|
require 'uricp/orbit_auth'
|
23
26
|
|
24
27
|
module Uricp
|
25
|
-
|
26
28
|
UnsupportedURLtype = Class.new(ArgumentError)
|
27
29
|
MissingCache = Class.new(ArgumentError)
|
28
30
|
UnsupportedConversion = Class.new(ArgumentError)
|
29
31
|
ConversionRequired = Class.new(ArgumentError)
|
30
|
-
|
31
32
|
end
|
32
|
-
|
@@ -1,45 +1,43 @@
|
|
1
1
|
module Uricp::CurlPrimitives
|
2
|
+
attr_reader :options
|
2
3
|
|
3
|
-
|
4
|
+
def from
|
5
|
+
options['from_uri']
|
6
|
+
end
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
def from=(target)
|
9
|
+
options['from_uri'] = target
|
10
|
+
end
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
def to
|
13
|
+
options['to_uri']
|
14
|
+
end
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
def to=(target)
|
17
|
+
options['to_uri'] = target
|
18
|
+
end
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
def curl_command
|
22
|
-
"curl --fail --silent"
|
23
|
-
end
|
20
|
+
def curl_command
|
21
|
+
'curl --fail --silent'
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def authentication
|
25
|
+
"-H X-Auth-Token:#{options['authenticator'].call}" if http_authentication?
|
26
|
+
end
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def http_authentication?
|
29
|
+
options['authenticator']
|
30
|
+
end
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
def curl_upload_from(source, destination = to)
|
33
|
+
"#{curl_command} #{authentication} -T #{source} #{destination};"
|
34
|
+
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
def curl_download_to_pipe
|
37
|
+
"#{curl_command} #{authentication} #{from} |"
|
38
|
+
end
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
def curl_manifest(object_manifest, destination = to)
|
41
|
+
"#{curl_command} #{authentication} -X PUT -H 'X-Object-Manifest: #{object_manifest}' #{destination} --data-binary ''"
|
42
|
+
end
|
45
43
|
end
|
data/lib/uricp/orbit_auth.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'open-uri'
|
2
2
|
module Uricp
|
3
|
-
|
4
3
|
class OrbitAuth
|
5
|
-
|
6
4
|
AuthenticationFailure = Class.new(ArgumentError)
|
7
5
|
|
8
6
|
def initialize(auth_uri, auth_id, auth_key)
|
@@ -14,9 +12,9 @@ module Uricp
|
|
14
12
|
def storage_url
|
15
13
|
@storage_url ||
|
16
14
|
begin
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
authenticate
|
16
|
+
@storage_url
|
17
|
+
end
|
20
18
|
end
|
21
19
|
|
22
20
|
def token
|
@@ -26,27 +24,27 @@ module Uricp
|
|
26
24
|
|
27
25
|
def self.validate_options(options)
|
28
26
|
if options['auth-token'] && (options['auth-key'] || options['auth-user'])
|
29
|
-
|
30
|
-
|
27
|
+
raise ::OptionParser::NeedlessArgument,
|
28
|
+
'use either key based or token based authentication'
|
31
29
|
end
|
32
30
|
if options['auth-key'].nil? ^ options['auth-user'].nil?
|
33
|
-
|
34
|
-
|
31
|
+
raise ::OptionParser::MissingArgument,
|
32
|
+
"'auth-user' requires 'auth-key'"
|
35
33
|
end
|
36
34
|
if (options['auth-token'] || options['auth-user']) && options['auth_uri'].nil?
|
37
|
-
|
38
|
-
|
35
|
+
raise ::OptionParser::NeedlessArgument,
|
36
|
+
'authentication is for http uris only'
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
42
40
|
def self.add_auth_token(options)
|
43
41
|
if options['auth-user']
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
orbit_credentials = new(options['auth_uri'],
|
43
|
+
options['auth-user'], options['auth-key'])
|
44
|
+
options['authenticator'] = orbit_credentials.method(:token)
|
47
45
|
elsif options['auth-token']
|
48
46
|
orbit_token = options['auth-token']
|
49
|
-
options['authenticator'] =
|
47
|
+
options['authenticator'] = -> { orbit_token }
|
50
48
|
end
|
51
49
|
options.delete('auth-key')
|
52
50
|
options.delete('auth-user')
|
@@ -54,29 +52,27 @@ module Uricp
|
|
54
52
|
end
|
55
53
|
|
56
54
|
def self.add_auth_to_optionparser(app)
|
57
|
-
app.on(
|
58
|
-
|
59
|
-
app.on(
|
60
|
-
|
61
|
-
app.on(
|
62
|
-
|
55
|
+
app.on('--auth-token AUTH_TOKEN',
|
56
|
+
'Use AUTH_TOKEN for non-local requests')
|
57
|
+
app.on('--auth-user AUTH_USER',
|
58
|
+
'Use AUTH_USER for authentication')
|
59
|
+
app.on('--auth-key AUTH_KEY',
|
60
|
+
'Use AUTH_KEY for authentication')
|
63
61
|
end
|
64
62
|
|
65
|
-
|
63
|
+
private
|
66
64
|
|
67
65
|
def authenticate
|
68
66
|
@auth_uri.open(
|
69
67
|
'X-Auth-User' => @auth_id,
|
70
|
-
|
71
|
-
|
68
|
+
'X-Auth-Key' => @auth_key,
|
69
|
+
'Range' => 'bytes=0-0'
|
72
70
|
) do |uri|
|
73
71
|
@storage_url = uri.meta['x-storage-url']
|
74
|
-
|
72
|
+
@token = uri.meta['x-auth-token']
|
75
73
|
end
|
76
74
|
rescue OpenURI::HTTPError => e
|
77
75
|
raise AuthenticationFailure, "Cannot authenticate against #{@auth_uri}"
|
78
76
|
end
|
79
|
-
|
80
77
|
end
|
81
|
-
|
82
78
|
end
|