uricp 0.0.6 → 0.0.7
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.
- data/.gitignore +2 -1
- data/Dockerfile_centos6.6 +39 -0
- data/Dockerfile_centos7 +39 -0
- data/Dockerfile_trusty-ruby193 +32 -0
- data/Gemfile.lock +62 -0
- data/Rakefile +12 -4
- data/bin/segment_upload +1 -1
- data/bin/uricp +1 -1
- data/cucumber.yml +3 -0
- data/features/auth_download.feature +1 -0
- data/features/cacheable_from_uri.feature +8 -7
- data/features/documented_options.feature +1 -1
- data/features/qcow2_auth_download.feature +115 -0
- data/features/remote_upload.feature +2 -0
- data/features/segmented_upload.feature +1 -0
- data/features/segmented_upload_options.feature +2 -2
- data/features/step_definitions/orbit_steps.rb +23 -11
- data/features/userid_download.feature +8 -1
- data/lib/segment_upload.rb +1 -1
- data/lib/uricp/version.rb +1 -1
- data/uricp.gemspec +2 -1
- metadata +27 -4
data/.gitignore
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
FROM centos:6.6
|
|
2
|
+
MAINTAINER support@brightbox.co.uk
|
|
3
|
+
|
|
4
|
+
RUN yum update -y && yum -y install \
|
|
5
|
+
epel-release \
|
|
6
|
+
gcc \
|
|
7
|
+
git \
|
|
8
|
+
make \
|
|
9
|
+
qemu-img \
|
|
10
|
+
ruby-devel \
|
|
11
|
+
rubygems
|
|
12
|
+
|
|
13
|
+
RUN yum update -y && yum -y install \
|
|
14
|
+
python-setuptools \
|
|
15
|
+
python-requests \
|
|
16
|
+
python-devel \
|
|
17
|
+
python-simplejson \
|
|
18
|
+
python-futures \
|
|
19
|
+
lz4
|
|
20
|
+
|
|
21
|
+
RUN easy_install pip
|
|
22
|
+
RUN pip install --upgrade setuptools
|
|
23
|
+
RUN pip install python-swiftclient
|
|
24
|
+
|
|
25
|
+
RUN echo "gem: --no-ri --no-rdoc" >> "$HOME/.gemrc"
|
|
26
|
+
RUN gem install bundler
|
|
27
|
+
|
|
28
|
+
RUN mkdir /app
|
|
29
|
+
WORKDIR /app
|
|
30
|
+
|
|
31
|
+
COPY Gemfile /app/Gemfile
|
|
32
|
+
COPY Gemfile.lock /app/Gemfile.lock
|
|
33
|
+
COPY uricp.gemspec /app/uricp.gemspec
|
|
34
|
+
COPY lib/uricp/version.rb /app/lib/uricp/version.rb
|
|
35
|
+
RUN bundle install --deployment
|
|
36
|
+
|
|
37
|
+
COPY . /app
|
|
38
|
+
|
|
39
|
+
CMD bundle exec rake features:old_qemu
|
data/Dockerfile_centos7
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
FROM centos:7
|
|
2
|
+
MAINTAINER support@brightbox.co.uk
|
|
3
|
+
|
|
4
|
+
RUN yum update -y && yum -y install \
|
|
5
|
+
epel-release \
|
|
6
|
+
gcc \
|
|
7
|
+
make \
|
|
8
|
+
git \
|
|
9
|
+
qemu-img \
|
|
10
|
+
ruby-devel \
|
|
11
|
+
rubygems \
|
|
12
|
+
|
|
13
|
+
RUN yum update -y && yum -y install \
|
|
14
|
+
python-setuptools \
|
|
15
|
+
python-requests \
|
|
16
|
+
python-devel \
|
|
17
|
+
python-simplejson \
|
|
18
|
+
python-futures \
|
|
19
|
+
lz4
|
|
20
|
+
|
|
21
|
+
RUN easy_install pip
|
|
22
|
+
RUN pip install --upgrade setuptools
|
|
23
|
+
RUN pip install python-swiftclient
|
|
24
|
+
|
|
25
|
+
RUN echo "gem: --no-ri --no-rdoc" >> "$HOME/.gemrc"
|
|
26
|
+
RUN gem install bundler
|
|
27
|
+
|
|
28
|
+
RUN mkdir /app
|
|
29
|
+
WORKDIR /app
|
|
30
|
+
|
|
31
|
+
COPY Gemfile /app/Gemfile
|
|
32
|
+
COPY Gemfile.lock /app/Gemfile.lock
|
|
33
|
+
COPY uricp.gemspec /app/uricp.gemspec
|
|
34
|
+
COPY lib/uricp/version.rb /app/lib/uricp/version.rb
|
|
35
|
+
RUN bundle install --deployment
|
|
36
|
+
|
|
37
|
+
COPY . /app
|
|
38
|
+
|
|
39
|
+
CMD bundle exec rake features:new_qemu
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
FROM ubuntu:trusty
|
|
2
|
+
MAINTAINER support@brightbox.co.uk
|
|
3
|
+
|
|
4
|
+
RUN apt-get update && apt-get install -y -qq software-properties-common
|
|
5
|
+
|
|
6
|
+
RUN apt-add-repository ppa:brightbox/ruby-ng
|
|
7
|
+
|
|
8
|
+
RUN apt-get update && apt-get install -y -qq \
|
|
9
|
+
build-essential \
|
|
10
|
+
git \
|
|
11
|
+
qemu-utils \
|
|
12
|
+
liblz4-tool \
|
|
13
|
+
curl \
|
|
14
|
+
ruby1.9.3 \
|
|
15
|
+
ruby-dev \
|
|
16
|
+
python-swiftclient
|
|
17
|
+
|
|
18
|
+
RUN echo "gem: --no-ri --no-rdoc" >> "$HOME/.gemrc"
|
|
19
|
+
RUN gem install bundler
|
|
20
|
+
|
|
21
|
+
RUN mkdir /app
|
|
22
|
+
WORKDIR /app
|
|
23
|
+
|
|
24
|
+
COPY Gemfile /app/Gemfile
|
|
25
|
+
COPY Gemfile.lock /app/Gemfile.lock
|
|
26
|
+
COPY uricp.gemspec /app/uricp.gemspec
|
|
27
|
+
COPY lib/uricp/version.rb /app/lib/uricp/version.rb
|
|
28
|
+
RUN bundle install --deployment
|
|
29
|
+
|
|
30
|
+
COPY . /app
|
|
31
|
+
|
|
32
|
+
CMD bundle exec rake features:new_qemu
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
uricp (0.0.7)
|
|
5
|
+
filesize (= 0.0.2)
|
|
6
|
+
methadone (~> 1.8.0)
|
|
7
|
+
open4 (~> 1.3.0)
|
|
8
|
+
sendfile (~> 1.2.0)
|
|
9
|
+
|
|
10
|
+
GEM
|
|
11
|
+
remote: https://rubygems.org/
|
|
12
|
+
specs:
|
|
13
|
+
aruba (0.6.2)
|
|
14
|
+
childprocess (>= 0.3.6)
|
|
15
|
+
cucumber (>= 1.1.1)
|
|
16
|
+
rspec-expectations (>= 2.7.0)
|
|
17
|
+
builder (3.2.2)
|
|
18
|
+
childprocess (0.5.5)
|
|
19
|
+
ffi (~> 1.0, >= 1.0.11)
|
|
20
|
+
cucumber (1.3.19)
|
|
21
|
+
builder (>= 2.1.2)
|
|
22
|
+
diff-lcs (>= 1.1.3)
|
|
23
|
+
gherkin (~> 2.12)
|
|
24
|
+
multi_json (>= 1.7.5, < 2.0)
|
|
25
|
+
multi_test (>= 0.1.2)
|
|
26
|
+
diff-lcs (1.2.5)
|
|
27
|
+
ffi (1.9.8)
|
|
28
|
+
filesize (0.0.2)
|
|
29
|
+
gherkin (2.12.2)
|
|
30
|
+
multi_json (~> 1.3)
|
|
31
|
+
inifile (1.1.0)
|
|
32
|
+
json (1.8.2)
|
|
33
|
+
methadone (1.8.0)
|
|
34
|
+
bundler
|
|
35
|
+
multi_json (1.11.0)
|
|
36
|
+
multi_test (0.1.2)
|
|
37
|
+
open4 (1.3.4)
|
|
38
|
+
rake (10.4.2)
|
|
39
|
+
rdoc (4.2.0)
|
|
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
|
+
rspec-expectations (2.99.2)
|
|
47
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
48
|
+
rspec-mocks (2.99.3)
|
|
49
|
+
sendfile (1.2.2)
|
|
50
|
+
|
|
51
|
+
PLATFORMS
|
|
52
|
+
ruby
|
|
53
|
+
|
|
54
|
+
DEPENDENCIES
|
|
55
|
+
aruba
|
|
56
|
+
bundler (~> 1.7)
|
|
57
|
+
cucumber (~> 1.3)
|
|
58
|
+
inifile (~> 1.1)
|
|
59
|
+
rake
|
|
60
|
+
rdoc
|
|
61
|
+
rspec (~> 2.99)
|
|
62
|
+
uricp!
|
data/Rakefile
CHANGED
|
@@ -50,9 +50,17 @@ end
|
|
|
50
50
|
|
|
51
51
|
CUKE_RESULTS = 'results.html'
|
|
52
52
|
CLEAN << CUKE_RESULTS
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
namespace(:features) do
|
|
54
|
+
Cucumber::Rake::Task.new(:new_qemu) do |t|
|
|
55
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
|
|
56
|
+
t.fork = false
|
|
57
|
+
t.profile = 'new-qemu-image'
|
|
58
|
+
end
|
|
59
|
+
Cucumber::Rake::Task.new(:old_qemu) do |t|
|
|
60
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
|
|
61
|
+
t.fork = false
|
|
62
|
+
t.profile = 'old-qemu-image'
|
|
63
|
+
end
|
|
56
64
|
end
|
|
57
65
|
|
|
58
66
|
Rake::RDocTask.new do |rd|
|
|
@@ -62,5 +70,5 @@ Rake::RDocTask.new do |rd|
|
|
|
62
70
|
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
|
63
71
|
end
|
|
64
72
|
|
|
65
|
-
task :default => [:spec
|
|
73
|
+
task :default => [:spec,"features:new_qemu"]
|
|
66
74
|
|
data/bin/segment_upload
CHANGED
|
@@ -11,7 +11,7 @@ class App
|
|
|
11
11
|
include Methadone::SH
|
|
12
12
|
include Methadone::CLILogging
|
|
13
13
|
|
|
14
|
-
main do |to_uri
|
|
14
|
+
main do |to_uri,|
|
|
15
15
|
options['auth_uri'] = options['to_uri'] = URI(to_uri)
|
|
16
16
|
options['segment-size'] = Filesize.from(options['segment-size'])
|
|
17
17
|
Uricp::OrbitAuth.validate_options(options)
|
data/bin/uricp
CHANGED
data/cucumber.yml
ADDED
|
@@ -8,13 +8,13 @@ Feature: Download Public VM images
|
|
|
8
8
|
And the default aruba timeout is 15 seconds
|
|
9
9
|
|
|
10
10
|
Scenario: HTTP URI qcow2 to qcow2
|
|
11
|
-
When I successfully run `uricp
|
|
11
|
+
When I successfully run `uricp http://orbit.brightbox.com/v1/acc-tqs4c/downloads/freedos.qcow2 file:///tmp/uricp/srv-testy`
|
|
12
12
|
Then a file named "/tmp/uricp/srv-testy" should exist
|
|
13
13
|
And the file named "/tmp/uricp/srv-testy" should have a file format of "qcow2"
|
|
14
14
|
|
|
15
15
|
Scenario: HTTP URI qcow2 via cache
|
|
16
16
|
Given a correctly initialised cache at "/tmp/uricp"
|
|
17
|
-
When I successfully run `uricp --cache=/tmp/uricp
|
|
17
|
+
When I successfully run `uricp --cache=/tmp/uricp http://orbit.brightbox.com/v1/acc-tqs4c/downloads/freedos.qcow2 file:///tmp/uricp/srv-testy`
|
|
18
18
|
Then a file named "/tmp/uricp/srv-testy" should exist
|
|
19
19
|
And the file named "/tmp/uricp/srv-testy" should have a file format of "qcow2"
|
|
20
20
|
And a file named "/tmp/uricp/cache/freedos.qcow2" should exist
|
|
@@ -22,15 +22,16 @@ Feature: Download Public VM images
|
|
|
22
22
|
|
|
23
23
|
Scenario: HTTP URI qcow2 to qcow2 via cache
|
|
24
24
|
Given a correctly initialised cache at "/tmp/uricp"
|
|
25
|
-
When I successfully run `uricp --target-format=qcow2 --cache=/tmp/uricp
|
|
25
|
+
When I successfully run `uricp --target-format=qcow2 --cache=/tmp/uricp http://orbit.brightbox.com/v1/acc-tqs4c/downloads/freedos.qcow2 file:///tmp/uricp/srv-testy`
|
|
26
26
|
Then a file named "/tmp/uricp/srv-testy" should exist
|
|
27
27
|
And the file named "/tmp/uricp/srv-testy" should have a file format of "qcow2"
|
|
28
28
|
And a file named "/tmp/uricp/cache/freedos.qcow2" should exist
|
|
29
29
|
And the file named "/tmp/uricp/cache/freedos.qcow2" should have a file format of "qcow2"
|
|
30
30
|
|
|
31
|
+
@new-qemu-image
|
|
31
32
|
Scenario: HTTP URI qcow2 to qcow2v3 via cache
|
|
32
33
|
Given a correctly initialised cache at "/tmp/uricp"
|
|
33
|
-
When I successfully run `uricp --target-format=qcow2v3 --cache=/tmp/uricp
|
|
34
|
+
When I successfully run `uricp --target-format=qcow2v3 --cache=/tmp/uricp http://orbit.brightbox.com/v1/acc-tqs4c/downloads/freedos.qcow2 file:///tmp/uricp/srv-testy`
|
|
34
35
|
Then a file named "/tmp/uricp/srv-testy" should exist
|
|
35
36
|
And the file named "/tmp/uricp/srv-testy" should have a file format of "qcow2v3"
|
|
36
37
|
And a file named "/tmp/uricp/cache/freedos.qcow2" should exist
|
|
@@ -38,7 +39,7 @@ Feature: Download Public VM images
|
|
|
38
39
|
|
|
39
40
|
Scenario: HTTP URI qcow2 to raw via cache
|
|
40
41
|
Given a correctly initialised cache at "/tmp/uricp"
|
|
41
|
-
When I successfully run `uricp --target-format=raw --cache=/tmp/uricp
|
|
42
|
+
When I successfully run `uricp --target-format=raw --cache=/tmp/uricp http://orbit.brightbox.com/v1/acc-tqs4c/downloads/freedos.qcow2 file:///tmp/uricp/srv-testy`
|
|
42
43
|
Then a file named "/tmp/uricp/srv-testy" should exist
|
|
43
44
|
And the file named "/tmp/uricp/srv-testy" should have a file format of "raw"
|
|
44
45
|
And a file named "/tmp/uricp/cache/freedos.qcow2" should exist
|
|
@@ -48,7 +49,7 @@ Feature: Download Public VM images
|
|
|
48
49
|
Scenario: HTTP URI from cache
|
|
49
50
|
Given a correctly initialised cache at "/tmp/uricp"
|
|
50
51
|
And a 102400 byte file named "/tmp/uricp/cache/freedos.qcow2"
|
|
51
|
-
When I successfully run `uricp --cache=/tmp/uricp
|
|
52
|
+
When I successfully run `uricp --cache=/tmp/uricp http://orbit.brightbox.com/v1/acc-tqs4c/downloads/freedos.qcow2 file:///tmp/uricp/srv-testy`
|
|
52
53
|
Then a 102400 byte file named "/tmp/uricp/srv-testy" should exist
|
|
53
54
|
And a 102400 byte file named "/tmp/uricp/cache/freedos.qcow2" should exist
|
|
54
55
|
|
|
@@ -60,7 +61,7 @@ Feature: Download Public VM images
|
|
|
60
61
|
|
|
61
62
|
Scenario: Unsupported target URI should error
|
|
62
63
|
Given a correctly initialised cache at "/tmp/uricp"
|
|
63
|
-
When I run `uricp --target-format=raw --cache=/tmp/uricp
|
|
64
|
+
When I run `uricp --target-format=raw --cache=/tmp/uricp http://orbit.brightbox.com/v1/acc-tqs4c/downloads/freedos.qcow2 http://orbit.brightbox.com/v1/acc-tqs4c/downloads/freedos.qcow2`
|
|
64
65
|
Then the exit status should not be 0
|
|
65
66
|
And the stderr should contain "Unsupported transfer"
|
|
66
67
|
|
|
@@ -58,7 +58,7 @@ Feature: Documented Help
|
|
|
58
58
|
And the stderr should contain "needless argument"
|
|
59
59
|
|
|
60
60
|
Scenario: authentication with normal http should fail
|
|
61
|
-
When I run `uricp --auth-user cli-xxxxx --auth-key fred
|
|
61
|
+
When I run `uricp --auth-user cli-xxxxx --auth-key fred http://orbit.brightbox.com/v1/acc-tqc4c/downloads/freedos.qcow2 file://tmp/temp`
|
|
62
62
|
Then the exit status should not be 0
|
|
63
63
|
And the stderr should contain "Cannot authenticate"
|
|
64
64
|
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
@orbit
|
|
2
|
+
@orbitdownloads
|
|
3
|
+
@old-qemu-image
|
|
4
|
+
Feature: Authenticated download of images from orbit
|
|
5
|
+
In order to download images from orbit
|
|
6
|
+
As a command line user
|
|
7
|
+
I want to retrieve the URI via an optional cache and copy correctly to target in the right format
|
|
8
|
+
|
|
9
|
+
Background:
|
|
10
|
+
Given an empty directory named "/tmp/uricp"
|
|
11
|
+
And the default aruba timeout is 15 seconds
|
|
12
|
+
And a container called "test"
|
|
13
|
+
|
|
14
|
+
Scenario: qcow download no conversion, no cache
|
|
15
|
+
When I retrieve "img-qcow2" from container "test" into "file:///tmp/uricp/srv-test1"
|
|
16
|
+
Then a file named "/tmp/uricp/srv-test1" should exist
|
|
17
|
+
And the file named "/tmp/uricp/srv-test1" should have a file format of "qcow2"
|
|
18
|
+
|
|
19
|
+
Scenario: lz4 download no conversion, no cache
|
|
20
|
+
When I retrieve "img-lz4cy" from container "test" into "file:///tmp/uricp/srv-test2"
|
|
21
|
+
Then a file named "/tmp/uricp/srv-test2" should exist
|
|
22
|
+
And the file named "/tmp/uricp/srv-test2" should have a file format of "lz4"
|
|
23
|
+
|
|
24
|
+
Scenario: qcow download no conversion, cache
|
|
25
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
26
|
+
When I retrieve "img-qcow2" with options "--cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-test3"
|
|
27
|
+
Then a file named "/tmp/uricp/srv-test3" should exist
|
|
28
|
+
And the file named "/tmp/uricp/srv-test3" should have a file format of "qcow2"
|
|
29
|
+
And a file named "/tmp/uricp/cache/img-qcow2" should exist
|
|
30
|
+
And the file named "/tmp/uricp/cache/img-qcow2" should have a file format of "qcow2"
|
|
31
|
+
|
|
32
|
+
Scenario: zero download convert to qcow2, cache
|
|
33
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
34
|
+
When I retrieve "img-zeroy" with options "--target-format=qcow2 --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-testz"
|
|
35
|
+
Then a file named "/tmp/uricp/srv-testz" should exist
|
|
36
|
+
And the file named "/tmp/uricp/srv-testz" should have a file format of "qcow2"
|
|
37
|
+
And a 0 byte file named "/tmp/uricp/cache/img-zeroy" should exist
|
|
38
|
+
And the file named "/tmp/uricp/cache/img-zeroy" should have a file format of "raw"
|
|
39
|
+
|
|
40
|
+
Scenario: qcow download convert to raw, cache
|
|
41
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
42
|
+
When I retrieve "img-qcow2" with options "--target-format=raw --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-test4"
|
|
43
|
+
Then a file named "/tmp/uricp/srv-test4" should exist
|
|
44
|
+
And the file named "/tmp/uricp/srv-test4" should have a file format of "raw"
|
|
45
|
+
And a file named "/tmp/uricp/cache/img-qcow2" should exist
|
|
46
|
+
And the file named "/tmp/uricp/cache/img-qcow2" should have a file format of "qcow2"
|
|
47
|
+
|
|
48
|
+
Scenario: qcow download convert to qcow2, cache
|
|
49
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
50
|
+
When I retrieve "img-qcow2" with options "--target-format=qcow2 --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-test5"
|
|
51
|
+
Then a file named "/tmp/uricp/srv-test5" should exist
|
|
52
|
+
And the file named "/tmp/uricp/srv-test5" should have a file format of "qcow2"
|
|
53
|
+
And a file named "/tmp/uricp/cache/img-qcow2" should exist
|
|
54
|
+
And the file named "/tmp/uricp/cache/img-qcow2" should have a file format of "qcow2"
|
|
55
|
+
|
|
56
|
+
Scenario: qcow download no conversion, from cache
|
|
57
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
58
|
+
And a cache of "img-qcow2" from container "test" at "/tmp/uricp"
|
|
59
|
+
When I retrieve "img-qcow2" with options "--cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-test6"
|
|
60
|
+
Then a file named "/tmp/uricp/srv-test6" should exist
|
|
61
|
+
And the file named "/tmp/uricp/srv-test6" should have a file format of "qcow2"
|
|
62
|
+
And a file named "/tmp/uricp/cache/img-qcow2" should exist
|
|
63
|
+
And the file named "/tmp/uricp/cache/img-qcow2" should have a file format of "qcow2"
|
|
64
|
+
|
|
65
|
+
Scenario: qcow download convert to raw from cache
|
|
66
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
67
|
+
And a cache of "img-qcow2" from container "test" at "/tmp/uricp"
|
|
68
|
+
When I retrieve "img-qcow2" with options "--target-format=raw --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-test7"
|
|
69
|
+
Then a file named "/tmp/uricp/srv-test7" should exist
|
|
70
|
+
And the file named "/tmp/uricp/srv-test7" should have a file format of "raw"
|
|
71
|
+
And a file named "/tmp/uricp/cache/img-qcow2" should exist
|
|
72
|
+
And the file named "/tmp/uricp/cache/img-qcow2" should have a file format of "qcow2"
|
|
73
|
+
|
|
74
|
+
Scenario: qcow download convert to qcow2 from cache
|
|
75
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
76
|
+
And a cache of "img-qcow2" from container "test" at "/tmp/uricp"
|
|
77
|
+
When I retrieve "img-qcow2" with options "--target-format=qcow2 --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-test8"
|
|
78
|
+
Then a file named "/tmp/uricp/srv-test8" should exist
|
|
79
|
+
And the file named "/tmp/uricp/srv-test8" should have a file format of "qcow2"
|
|
80
|
+
And a file named "/tmp/uricp/cache/img-qcow2" should exist
|
|
81
|
+
And the file named "/tmp/uricp/cache/img-qcow2" should have a file format of "qcow2"
|
|
82
|
+
|
|
83
|
+
Scenario: lz4 download convert to raw, cache
|
|
84
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
85
|
+
When I retrieve "img-lz4cy" with options "--target-format=raw --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-test9"
|
|
86
|
+
Then a file named "/tmp/uricp/srv-test9" should exist
|
|
87
|
+
And the file named "/tmp/uricp/srv-test9" should have a file format of "raw"
|
|
88
|
+
And a file named "/tmp/uricp/cache/img-lz4cy" should exist
|
|
89
|
+
And the file named "/tmp/uricp/cache/img-lz4cy" should have a file format of "lz4"
|
|
90
|
+
|
|
91
|
+
Scenario: lz4 download convert to raw, from cache
|
|
92
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
93
|
+
And a cache of "img-lz4cy" from container "test" at "/tmp/uricp"
|
|
94
|
+
When I retrieve "img-lz4cy" with options "--target-format=raw --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-testa"
|
|
95
|
+
Then a file named "/tmp/uricp/srv-testa" should exist
|
|
96
|
+
And the file named "/tmp/uricp/srv-testa" should have a file format of "raw"
|
|
97
|
+
And a file named "/tmp/uricp/cache/img-lz4cy" should exist
|
|
98
|
+
And the file named "/tmp/uricp/cache/img-lz4cy" should have a file format of "lz4"
|
|
99
|
+
|
|
100
|
+
Scenario: lz4 download convert to qcow2, cache
|
|
101
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
102
|
+
When I retrieve "img-lz4cy" with options "--target-format=qcow2 --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-testb"
|
|
103
|
+
Then a file named "/tmp/uricp/srv-testb" should exist
|
|
104
|
+
And the file named "/tmp/uricp/srv-testb" should have a file format of "qcow2"
|
|
105
|
+
And a file named "/tmp/uricp/cache/img-lz4cy" should exist
|
|
106
|
+
And the file named "/tmp/uricp/cache/img-lz4cy" should have a file format of "lz4"
|
|
107
|
+
|
|
108
|
+
Scenario: lz4 download convert to qcow2, from cache
|
|
109
|
+
Given a correctly initialised cache at "/tmp/uricp"
|
|
110
|
+
And a cache of "img-lz4cy" from container "test" at "/tmp/uricp"
|
|
111
|
+
When I retrieve "img-lz4cy" with options "--target-format=qcow2 --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-testa"
|
|
112
|
+
Then a file named "/tmp/uricp/srv-testa" should exist
|
|
113
|
+
And the file named "/tmp/uricp/srv-testa" should have a file format of "qcow2"
|
|
114
|
+
And a file named "/tmp/uricp/cache/img-lz4cy" should exist
|
|
115
|
+
And the file named "/tmp/uricp/cache/img-lz4cy" should have a file format of "lz4"
|
|
@@ -37,6 +37,7 @@ Feature: Upload VM images with authentication
|
|
|
37
37
|
|
|
38
38
|
Scenario: Direct segmented Upload with userid in qcow2 format
|
|
39
39
|
Given a 102400 byte file named "/tmp/uricp/srv-testd"
|
|
40
|
+
And the default aruba timeout is 60 seconds
|
|
40
41
|
And a correctly initialised cache at "/tmp/uricp"
|
|
41
42
|
When I store "img-testd" with segment size "10kiB" and options "--target-format 'qcow2' --cache /tmp/uricp" into container "test_upload" from "file:///tmp/uricp/srv-testd" with a userid
|
|
42
43
|
Then a qcow2 entry should exist in container "test_upload" called "img-testd"
|
|
@@ -50,6 +51,7 @@ Feature: Upload VM images with authentication
|
|
|
50
51
|
|
|
51
52
|
Scenario: Direct upload with userid of zero byte file.
|
|
52
53
|
Given an empty file named "/tmp/uricp/srv-zerob"
|
|
54
|
+
And the default aruba timeout is 60 seconds
|
|
53
55
|
And a correctly initialised cache at "/tmp/uricp"
|
|
54
56
|
When I store "img-zerob" with segment size "10kiB" and options "--target-format 'qcow2' --cache /tmp/uricp" into container "test_upload" from "file:///tmp/uricp/srv-zerob" with a userid
|
|
55
57
|
Then a qcow2 entry should exist in container "test_upload" called "img-zerob"
|
|
@@ -25,3 +25,4 @@ Feature: Segmented Upload Command
|
|
|
25
25
|
When I upload "img-testb" with segment size "10kib" into container "temp_dlo" from "/tmp/uricp/srv-testb" as a stream
|
|
26
26
|
Then a 102400 byte entry should exist in container "temp_dlo" called "img-testb"
|
|
27
27
|
And the container "temp_dlo" should contain 11 entries
|
|
28
|
+
|
|
@@ -20,7 +20,7 @@ Feature: Documented Help for Segmented Upload
|
|
|
20
20
|
|to_uri|which is required|
|
|
21
21
|
|
|
22
22
|
Scenario: auth token and auth-user are mutually exclusive
|
|
23
|
-
When I run `segment_upload --auth-token abcdef --auth-user xyz --auth-key abc http://source
|
|
23
|
+
When I run `segment_upload --auth-token abcdef --auth-user xyz --auth-key abc http://source`
|
|
24
24
|
Then the exit status should not be 0
|
|
25
25
|
And the stderr should contain "needless argument"
|
|
26
26
|
|
|
@@ -45,7 +45,7 @@ Feature: Documented Help for Segmented Upload
|
|
|
45
45
|
And the stderr should contain "unsupported url"
|
|
46
46
|
|
|
47
47
|
Scenario: authentication with normal http should fail
|
|
48
|
-
When I run `segment_upload --auth-user cli-xxxxx --auth-key fred
|
|
48
|
+
When I run `segment_upload --auth-user cli-xxxxx --auth-key fred http://orbit.brightbox.com/v1/acc-tqs4c/downloads`
|
|
49
49
|
Then the exit status should not be 0
|
|
50
50
|
And the stderr should contain "Cannot authenticate"
|
|
51
51
|
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
require 'inifile'
|
|
2
2
|
|
|
3
3
|
def obtain_credentials
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
if ENV['ORBIT_USER'] && ENV['ORBIT_KEY']
|
|
5
|
+
[ENV['ORBIT_USER'], ENV['ORBIT_KEY']]
|
|
6
|
+
else
|
|
7
|
+
config = IniFile.load(ENV['HOME']+ '/.brightbox/config')
|
|
8
|
+
if config.nil? || config.sections.empty?
|
|
9
|
+
raise(RuntimeError, "No brightbox config in home directory. Can't obtain auth token for tests")
|
|
10
|
+
end
|
|
11
|
+
section = config.sections.first
|
|
12
|
+
[config[section]['client_id'], config[section]['secret']]
|
|
13
|
+
end
|
|
8
14
|
end
|
|
9
15
|
|
|
10
16
|
def fetch_orbit_token
|
|
11
17
|
@clientid, @key = obtain_credentials
|
|
12
|
-
|
|
18
|
+
@current_url_target = ENV['ORBIT_URL'] || 'https://orbit.brightbox.com/v1'
|
|
19
|
+
cmd = "curl -I #{@current_url_target} -H 'X-Auth-User: #{@clientid}' -H 'X-Auth-Key: #{@key}'"
|
|
13
20
|
run_simple(unescape(cmd))
|
|
14
21
|
stdout_from(cmd).each_line do |line|
|
|
15
22
|
key, value = line.strip.split(/\s*:\s*/,2)
|
|
16
23
|
@current_auth_token = value if key == 'X-Auth-Token'
|
|
17
24
|
@current_storage_url = value if key == 'X-Storage-Url'
|
|
18
25
|
end
|
|
26
|
+
raise(RuntimeError, "Credentials not accepted. Can't obtain auth token for tests.") unless @current_auth_token && @current_storage_url
|
|
19
27
|
end
|
|
20
28
|
|
|
21
29
|
def create_download_file(filetype, name, container)
|
|
@@ -30,7 +38,7 @@ def create_download_file(filetype, name, container)
|
|
|
30
38
|
when 'zero'
|
|
31
39
|
size = '0'
|
|
32
40
|
end
|
|
33
|
-
cmd = "qemu-img create -
|
|
41
|
+
cmd = "qemu-img create -f #{format} #{tempfile} #{size} >/dev/null 2>&1"
|
|
34
42
|
system(unescape(cmd))
|
|
35
43
|
cmd = "cat #{tempfile}"
|
|
36
44
|
if filetype == 'lz4'
|
|
@@ -60,9 +68,10 @@ Given(/^a cache of "(.*?)" from container "(.*?)" at "(.*?)"$/) do |name, contai
|
|
|
60
68
|
end
|
|
61
69
|
|
|
62
70
|
Given /^a (\d+) byte lz4 file named "([^"]*)"$/ do |file_size, file_name|
|
|
71
|
+
lz4_target=file_name+'.lz4'
|
|
63
72
|
write_fixed_size_file(file_name, file_size.to_i)
|
|
64
|
-
system("lz4c #{file_name}")
|
|
65
|
-
File.rename
|
|
73
|
+
system("lz4c #{file_name} #{lz4_target}")
|
|
74
|
+
File.rename lz4_target, file_name
|
|
66
75
|
end
|
|
67
76
|
|
|
68
77
|
When(/^I store "([^"]*)" into container "([^"]*)" from "([^"]*)"$/) do |name, container, source|
|
|
@@ -179,6 +188,11 @@ end
|
|
|
179
188
|
|
|
180
189
|
Before('@orbit') do
|
|
181
190
|
fetch_orbit_token
|
|
191
|
+
unless $orbit_setup
|
|
192
|
+
system("swift --quiet --insecure --os-storage-url=#{@current_storage_url} --os-auth-token=#{@current_auth_token} delete test")
|
|
193
|
+
system("swift --quiet --insecure --os-storage-url=#{@current_storage_url} --os-auth-token=#{@current_auth_token} delete temp_dlo")
|
|
194
|
+
system("swift --quiet --insecure --os-storage-url=#{@current_storage_url} --os-auth-token=#{@current_auth_token} delete test_upload")
|
|
195
|
+
end
|
|
182
196
|
end
|
|
183
197
|
|
|
184
198
|
Before('@orbitdownloads') do
|
|
@@ -194,9 +208,7 @@ end
|
|
|
194
208
|
|
|
195
209
|
After('@orbit') do
|
|
196
210
|
if @current_auth_token && @current_container
|
|
197
|
-
|
|
198
|
-
When I successfully run `swift --os-storage-url=#{@current_storage_url} --os-auth-token=#{@current_auth_token} delete #{@current_container} #{@current_name}`
|
|
199
|
-
}
|
|
211
|
+
system("swift --quiet --insecure --os-storage-url=#{@current_storage_url} --os-auth-token=#{@current_auth_token} delete #{@current_container} #{@current_name}")
|
|
200
212
|
@current_container = @current_name = nil
|
|
201
213
|
end
|
|
202
214
|
end
|
|
@@ -10,11 +10,18 @@ Feature: User authenticated download of images from orbit
|
|
|
10
10
|
And the default aruba timeout is 15 seconds
|
|
11
11
|
And a container called "test"
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
@new-qemu-image
|
|
14
|
+
Scenario: qcow2v3 download no conversion, no cache with userid
|
|
14
15
|
When I retrieve "img-qcow2" from container "test" into "file:///tmp/uricp/srv-test1" with a userid
|
|
15
16
|
Then a file named "/tmp/uricp/srv-test1" should exist
|
|
16
17
|
And the file named "/tmp/uricp/srv-test1" should have a file format of "qcow2v3"
|
|
17
18
|
|
|
19
|
+
@old-qemu-image
|
|
20
|
+
Scenario: qcow2 download no conversion, no cache with userid
|
|
21
|
+
When I retrieve "img-qcow2" from container "test" into "file:///tmp/uricp/srv-test1" with a userid
|
|
22
|
+
Then a file named "/tmp/uricp/srv-test1" should exist
|
|
23
|
+
And the file named "/tmp/uricp/srv-test1" should have a file format of "qcow2"
|
|
24
|
+
|
|
18
25
|
Scenario: direct upload with userid
|
|
19
26
|
Given a 102400 byte file named "/tmp/uricp/srv-testy"
|
|
20
27
|
When I store "img-usrid" into container "test" from "file:///tmp/uricp/srv-testy" with a userid
|
data/lib/segment_upload.rb
CHANGED
data/lib/uricp/version.rb
CHANGED
data/uricp.gemspec
CHANGED
|
@@ -22,11 +22,12 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
23
23
|
spec.add_development_dependency('rdoc')
|
|
24
24
|
spec.add_development_dependency('aruba')
|
|
25
|
+
spec.add_development_dependency('cucumber', '~> 1.3')
|
|
25
26
|
spec.add_development_dependency('rake')
|
|
26
27
|
spec.add_dependency('methadone', '~> 1.8.0')
|
|
27
28
|
spec.add_dependency('open4', '~> 1.3.0')
|
|
28
29
|
spec.add_dependency('filesize', '= 0.0.2')
|
|
29
30
|
spec.add_dependency('sendfile', '~> 1.2.0')
|
|
30
31
|
spec.add_development_dependency('rspec', '~> 2.99')
|
|
31
|
-
spec.add_development_dependency('inifile', '~>
|
|
32
|
+
spec.add_development_dependency('inifile', '~> 1.1')
|
|
32
33
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uricp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2015-
|
|
12
|
+
date: 2015-04-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -75,6 +75,22 @@ dependencies:
|
|
|
75
75
|
- - ! '>='
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
77
|
version: '0'
|
|
78
|
+
- !ruby/object:Gem::Dependency
|
|
79
|
+
name: cucumber
|
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
|
81
|
+
none: false
|
|
82
|
+
requirements:
|
|
83
|
+
- - ~>
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '1.3'
|
|
86
|
+
type: :development
|
|
87
|
+
prerelease: false
|
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
+
none: false
|
|
90
|
+
requirements:
|
|
91
|
+
- - ~>
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: '1.3'
|
|
78
94
|
- !ruby/object:Gem::Dependency
|
|
79
95
|
name: rake
|
|
80
96
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -178,7 +194,7 @@ dependencies:
|
|
|
178
194
|
requirements:
|
|
179
195
|
- - ~>
|
|
180
196
|
- !ruby/object:Gem::Version
|
|
181
|
-
version: '
|
|
197
|
+
version: '1.1'
|
|
182
198
|
type: :development
|
|
183
199
|
prerelease: false
|
|
184
200
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -186,7 +202,7 @@ dependencies:
|
|
|
186
202
|
requirements:
|
|
187
203
|
- - ~>
|
|
188
204
|
- !ruby/object:Gem::Version
|
|
189
|
-
version: '
|
|
205
|
+
version: '1.1'
|
|
190
206
|
description: Copy one URL to another with optional cacheing
|
|
191
207
|
email:
|
|
192
208
|
- neil@aldur.co.uk
|
|
@@ -197,16 +213,22 @@ extensions: []
|
|
|
197
213
|
extra_rdoc_files: []
|
|
198
214
|
files:
|
|
199
215
|
- .gitignore
|
|
216
|
+
- Dockerfile_centos6.6
|
|
217
|
+
- Dockerfile_centos7
|
|
218
|
+
- Dockerfile_trusty-ruby193
|
|
200
219
|
- Gemfile
|
|
220
|
+
- Gemfile.lock
|
|
201
221
|
- LICENSE.txt
|
|
202
222
|
- README.md
|
|
203
223
|
- README.rdoc
|
|
204
224
|
- Rakefile
|
|
205
225
|
- bin/segment_upload
|
|
206
226
|
- bin/uricp
|
|
227
|
+
- cucumber.yml
|
|
207
228
|
- features/auth_download.feature
|
|
208
229
|
- features/cacheable_from_uri.feature
|
|
209
230
|
- features/documented_options.feature
|
|
231
|
+
- features/qcow2_auth_download.feature
|
|
210
232
|
- features/remote_upload.feature
|
|
211
233
|
- features/segmented_upload.feature
|
|
212
234
|
- features/segmented_upload_options.feature
|
|
@@ -269,6 +291,7 @@ test_files:
|
|
|
269
291
|
- features/auth_download.feature
|
|
270
292
|
- features/cacheable_from_uri.feature
|
|
271
293
|
- features/documented_options.feature
|
|
294
|
+
- features/qcow2_auth_download.feature
|
|
272
295
|
- features/remote_upload.feature
|
|
273
296
|
- features/segmented_upload.feature
|
|
274
297
|
- features/segmented_upload_options.feature
|