uricp 0.0.18 → 0.0.20
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/Gemfile.lock +3 -2
- data/Jenkinsfile +88 -58
- data/Rakefile +5 -0
- data/almalinux8/Dockerfile +26 -0
- data/bin/uricp +25 -11
- data/bionic/Dockerfile +2 -1
- data/centos7/Dockerfile +16 -9
- data/cucumber.yml +1 -0
- data/features/check_uri_path.feature +14 -0
- data/features/rbd_access.feature +226 -0
- data/features/step_definitions/rbd_steps.rb +8 -0
- data/focal/Dockerfile +10 -3
- data/lib/uricp/strategy/cache_common.rb +19 -1
- data/lib/uricp/strategy/cached_get.rb +8 -5
- data/lib/uricp/strategy/common.rb +52 -1
- data/lib/uricp/strategy/piped_cache.rb +5 -4
- data/lib/uricp/strategy/piped_rbd_get.rb +8 -24
- data/lib/uricp/strategy/rbd_cache_base_snap.rb +27 -0
- data/lib/uricp/strategy/rbd_cache_check.rb +42 -0
- data/lib/uricp/strategy/rbd_cache_clone.rb +40 -0
- data/lib/uricp/strategy/rbd_cache_upload.rb +40 -0
- data/lib/uricp/strategy/rbd_cached_get.rb +36 -0
- data/lib/uricp/strategy/rbd_cached_put.rb +33 -0
- data/lib/uricp/strategy/rbd_flattener.rb +23 -0
- data/lib/uricp/strategy/{rbd_remote_put.rb → rbd_put.rb} +7 -5
- data/lib/uricp/strategy/rbd_snap.rb +56 -0
- data/lib/uricp/strategy/rbd_sweeper.rb +2 -1
- data/lib/uricp/uri_strategy.rb +9 -1
- data/lib/uricp/version.rb +1 -1
- data/lib/uricp.rb +27 -19
- data/uricp.gemspec +2 -1
- data/xenial/Dockerfile +2 -1
- metadata +34 -5
@@ -0,0 +1,33 @@
|
|
1
|
+
module Uricp::Strategy
|
2
|
+
class RbdCachedPut
|
3
|
+
include Uricp::Strategy::Common
|
4
|
+
include Uricp::Strategy::CacheCommon
|
5
|
+
|
6
|
+
def appropriate?
|
7
|
+
return proposal if to.scheme == 'rbd' &&
|
8
|
+
rbd_snapshot_spec?(from) &&
|
9
|
+
rbd_cache_name.nil? &&
|
10
|
+
!rbd_sequence_complete?
|
11
|
+
|
12
|
+
debug "#{self.class.name}: not appropriate"
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
def command
|
17
|
+
"rbd clone --no-progress --id #{rbd_id} '#{rbd_image_spec(from)}' '#{rbd_image_spec(to)}';"
|
18
|
+
end
|
19
|
+
|
20
|
+
def proposal
|
21
|
+
@proposed_options = options.dup
|
22
|
+
@proposed_options['from_uri'] = to
|
23
|
+
if options['rbd_cache_target']
|
24
|
+
@proposed_options['to_uri'] = options['rbd_cache_target']
|
25
|
+
@proposed_options['rbd_cache_name'] = rbd_image_spec(to)
|
26
|
+
@proposed_options['rbd_flatten'] ||= @proposed_options['rbd_cache_name']
|
27
|
+
@proposed_options.delete('rbd_cache_target')
|
28
|
+
end
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Uricp::Strategy
|
2
|
+
class RbdFlattener
|
3
|
+
include Uricp::Strategy::Common
|
4
|
+
|
5
|
+
def appropriate?
|
6
|
+
return proposal if options['rbd_flatten'] &&
|
7
|
+
rbd_sequence_complete?
|
8
|
+
|
9
|
+
debug "#{self.class.name}: not appropriate"
|
10
|
+
false
|
11
|
+
end
|
12
|
+
|
13
|
+
def command
|
14
|
+
"rbd flatten --id #{rbd_id} --no-progress '#{options['rbd_flatten']}' && "
|
15
|
+
end
|
16
|
+
|
17
|
+
def proposal
|
18
|
+
@proposed_options = options.dup
|
19
|
+
@proposed_options.delete('rbd_flatten')
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Uricp::Strategy
|
2
|
-
class
|
2
|
+
class RbdPut
|
3
3
|
include Uricp::Strategy::Common
|
4
4
|
|
5
5
|
def appropriate?
|
@@ -7,16 +7,18 @@ module Uricp::Strategy
|
|
7
7
|
debug "#{self.class.name}: not ready to upload"
|
8
8
|
return false
|
9
9
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
unless rbd_cache_name
|
11
|
+
case from.scheme
|
12
|
+
when 'pipe', 'file'
|
13
|
+
return proposal if to.scheme == 'rbd'
|
14
|
+
end
|
13
15
|
end
|
14
16
|
debug "#{self.class.name}: not appropriate"
|
15
17
|
false
|
16
18
|
end
|
17
19
|
|
18
20
|
def command
|
19
|
-
"rbd import --no-progress --id #{rbd_id} #{data_source} '#{
|
21
|
+
"rbd import --no-progress --id #{rbd_id} #{data_source} '#{rbd_image_spec(to)}';"
|
20
22
|
end
|
21
23
|
|
22
24
|
def proposal
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'json'
|
2
|
+
module Uricp::Strategy
|
3
|
+
class RbdSnap
|
4
|
+
include Uricp::Strategy::Common
|
5
|
+
include Uricp::Strategy::CacheCommon
|
6
|
+
include Methadone::SH
|
7
|
+
|
8
|
+
def appropriate?
|
9
|
+
without_active_cache do
|
10
|
+
if from.scheme == 'rbd' &&
|
11
|
+
options['rbd_snapshot'].nil? &&
|
12
|
+
!rbd_snapshot_spec?(from) &&
|
13
|
+
(rbd_cache_name.nil? ||
|
14
|
+
!from.path.include?(rbd_cache_name))
|
15
|
+
if snap_in_progress?
|
16
|
+
debug "#{self.class.name}: detected snapshot in progress"
|
17
|
+
else
|
18
|
+
return proposal unless sequence_complete?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
debug "#{self.class.name}: not appropriate"
|
23
|
+
false
|
24
|
+
end
|
25
|
+
|
26
|
+
def command
|
27
|
+
"rbd snap create --id #{rbd_id} '#{rbd_upload_snapshot(from)}' && " \
|
28
|
+
"rbd snap protect --id #{rbd_id} '#{rbd_upload_snapshot(from)}' && " \
|
29
|
+
end
|
30
|
+
|
31
|
+
def proposal
|
32
|
+
@proposed_options = options.dup
|
33
|
+
@proposed_options['rbd_snapshot'] = rbd_upload_snapshot(from)
|
34
|
+
@proposed_options['from_uri'] = rbd_uri(@proposed_options['rbd_snapshot'])
|
35
|
+
if options['rbd_cache_target']
|
36
|
+
@proposed_options['to_uri'] = options['rbd_cache_target']
|
37
|
+
@proposed_options['rbd_cache_target'] = to
|
38
|
+
end
|
39
|
+
self
|
40
|
+
end
|
41
|
+
|
42
|
+
def rbd_upload_snapshot(uri)
|
43
|
+
"#{rbd_image_spec(uri)}@#{rbd_snapshot_name}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def snap_in_progress?
|
47
|
+
return false if dry_run?
|
48
|
+
|
49
|
+
result = false
|
50
|
+
sh "rbd snap ls --id #{rbd_id} --format json #{rbd_image_spec(from)}" do |stdout|
|
51
|
+
result = JSON.parse(stdout).any? { |x| x['name'] == rbd_snapshot_name }
|
52
|
+
end
|
53
|
+
result
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -3,13 +3,14 @@ module Uricp::Strategy
|
|
3
3
|
include Uricp::Strategy::Common
|
4
4
|
|
5
5
|
def appropriate?
|
6
|
-
return proposal if options['rbd_snapshot'] &&
|
6
|
+
return proposal if options['rbd_snapshot'] && rbd_sequence_complete?
|
7
7
|
|
8
8
|
debug "#{self.class.name}: not appropriate"
|
9
9
|
false
|
10
10
|
end
|
11
11
|
|
12
12
|
def command
|
13
|
+
"rbd snap unprotect --id #{rbd_id} '#{options['rbd_snapshot']}' && " \
|
13
14
|
"rbd snap rm --id #{rbd_id} '#{options['rbd_snapshot']}';"
|
14
15
|
end
|
15
16
|
|
data/lib/uricp/uri_strategy.rb
CHANGED
@@ -25,6 +25,10 @@ module Uricp
|
|
25
25
|
|
26
26
|
# This is an ordered list from the most specific to the most general
|
27
27
|
STRATEGIES = [
|
28
|
+
Strategy::RbdCachedGet,
|
29
|
+
Strategy::RbdCacheClone,
|
30
|
+
Strategy::RbdCacheCheck,
|
31
|
+
Strategy::RbdSnap,
|
28
32
|
Strategy::CachedGet,
|
29
33
|
Strategy::PipedRemoteGet,
|
30
34
|
Strategy::PipedRbdGet,
|
@@ -35,13 +39,17 @@ module Uricp
|
|
35
39
|
Strategy::LocalConvert,
|
36
40
|
Strategy::LocalLink,
|
37
41
|
Strategy::PipedCompress,
|
38
|
-
Strategy::
|
42
|
+
Strategy::RbdCacheUpload,
|
43
|
+
Strategy::RbdCachedPut,
|
44
|
+
Strategy::RbdPut,
|
45
|
+
Strategy::RbdCacheBaseSnap,
|
39
46
|
Strategy::SegmentedRemotePut,
|
40
47
|
Strategy::RemotePut,
|
41
48
|
Strategy::PipedLocalCompress,
|
42
49
|
Strategy::PipedLocalGet,
|
43
50
|
Strategy::PipedLocalPut,
|
44
51
|
Strategy::Cleaner,
|
52
|
+
Strategy::RbdFlattener,
|
45
53
|
Strategy::RbdSweeper,
|
46
54
|
Strategy::Sweeper
|
47
55
|
].freeze
|
data/lib/uricp/version.rb
CHANGED
data/lib/uricp.rb
CHANGED
@@ -1,32 +1,40 @@
|
|
1
|
-
|
1
|
+
module Uricp
|
2
|
+
UnsupportedURLtype = Class.new(ArgumentError)
|
3
|
+
MissingCache = Class.new(ArgumentError)
|
4
|
+
UnsupportedConversion = Class.new(ArgumentError)
|
5
|
+
ConversionRequired = Class.new(ArgumentError)
|
6
|
+
end
|
7
|
+
|
2
8
|
require 'uricp/curl_primitives'
|
9
|
+
require 'uricp/orbit_auth'
|
3
10
|
require 'uricp/strategy/common'
|
4
11
|
require 'uricp/strategy/cache_common'
|
12
|
+
require 'uricp/strategy/cached_get'
|
13
|
+
require 'uricp/strategy/cleaner'
|
5
14
|
require 'uricp/strategy/local_convert'
|
6
15
|
require 'uricp/strategy/local_link'
|
7
16
|
require 'uricp/strategy/piped_cache'
|
8
17
|
require 'uricp/strategy/piped_cache_convert'
|
9
|
-
require 'uricp/strategy/piped_local_get'
|
10
|
-
require 'uricp/strategy/piped_rbd_get'
|
11
|
-
require 'uricp/strategy/piped_local_put'
|
12
|
-
require 'uricp/strategy/piped_remote_get'
|
13
18
|
require 'uricp/strategy/piped_compress'
|
14
19
|
require 'uricp/strategy/piped_decompress'
|
15
|
-
require 'uricp/strategy/piped_local_decompress'
|
16
20
|
require 'uricp/strategy/piped_local_compress'
|
17
|
-
require 'uricp/strategy/
|
18
|
-
require 'uricp/strategy/
|
19
|
-
require 'uricp/strategy/
|
20
|
-
require 'uricp/strategy/
|
21
|
+
require 'uricp/strategy/piped_local_decompress'
|
22
|
+
require 'uricp/strategy/piped_local_get'
|
23
|
+
require 'uricp/strategy/piped_local_put'
|
24
|
+
require 'uricp/strategy/piped_rbd_get'
|
25
|
+
require 'uricp/strategy/piped_remote_get'
|
26
|
+
require 'uricp/strategy/rbd_cache_base_snap'
|
27
|
+
require 'uricp/strategy/rbd_cache_check'
|
28
|
+
require 'uricp/strategy/rbd_cache_clone'
|
29
|
+
require 'uricp/strategy/rbd_cached_get'
|
30
|
+
require 'uricp/strategy/rbd_cached_put'
|
31
|
+
require 'uricp/strategy/rbd_cache_upload'
|
32
|
+
require 'uricp/strategy/rbd_flattener'
|
33
|
+
require 'uricp/strategy/rbd_put'
|
34
|
+
require 'uricp/strategy/rbd_snap'
|
21
35
|
require 'uricp/strategy/rbd_sweeper'
|
36
|
+
require 'uricp/strategy/remote_put'
|
37
|
+
require 'uricp/strategy/segmented_remote_put'
|
22
38
|
require 'uricp/strategy/sweeper'
|
23
|
-
require 'uricp/strategy/cleaner'
|
24
39
|
require 'uricp/uri_strategy'
|
25
|
-
require 'uricp/
|
26
|
-
|
27
|
-
module Uricp
|
28
|
-
UnsupportedURLtype = Class.new(ArgumentError)
|
29
|
-
MissingCache = Class.new(ArgumentError)
|
30
|
-
UnsupportedConversion = Class.new(ArgumentError)
|
31
|
-
ConversionRequired = Class.new(ArgumentError)
|
32
|
-
end
|
40
|
+
require 'uricp/version'
|
data/uricp.gemspec
CHANGED
@@ -23,7 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency('aruba', '~> 0.6.0')
|
24
24
|
spec.add_development_dependency('cucumber', '~> 1.3')
|
25
25
|
spec.add_development_dependency('rake', '~> 12.3')
|
26
|
-
spec.add_dependency('
|
26
|
+
spec.add_dependency('childprocess', '~> 1.0')
|
27
|
+
spec.add_dependency('methadone', '~> 2.0.2')
|
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')
|
data/xenial/Dockerfile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
FROM ubuntu:xenial
|
2
2
|
MAINTAINER support@brightbox.co.uk
|
3
3
|
|
4
|
+
RUN echo "gem: --no-ri --no-rdoc" >> "$HOME/.gemrc"
|
5
|
+
|
4
6
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq software-properties-common
|
5
7
|
|
6
8
|
#RUN apt-add-repository ppa:brightbox/ruby-ng
|
@@ -16,5 +18,4 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \
|
|
16
18
|
python-swiftclient \
|
17
19
|
ruby-bundler
|
18
20
|
|
19
|
-
RUN echo "gem: --no-ri --no-rdoc" >> "$HOME/.gemrc"
|
20
21
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,20 +80,34 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '12.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: childprocess
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: methadone
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.0.
|
103
|
+
version: 2.0.2
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.0.
|
110
|
+
version: 2.0.2
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: open4
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,6 +181,7 @@ files:
|
|
167
181
|
- LICENSE.txt
|
168
182
|
- README.md
|
169
183
|
- Rakefile
|
184
|
+
- almalinux8/Dockerfile
|
170
185
|
- bin/segment_upload
|
171
186
|
- bin/uricp
|
172
187
|
- bionic/Dockerfile
|
@@ -174,12 +189,15 @@ files:
|
|
174
189
|
- cucumber.yml
|
175
190
|
- features/auth_download.feature
|
176
191
|
- features/cacheable_from_uri.feature
|
192
|
+
- features/check_uri_path.feature
|
177
193
|
- features/documented_options.feature
|
178
194
|
- features/qcow2_auth_download.feature
|
195
|
+
- features/rbd_access.feature
|
179
196
|
- features/remote_upload.feature
|
180
197
|
- features/segmented_upload.feature
|
181
198
|
- features/segmented_upload_options.feature
|
182
199
|
- features/step_definitions/orbit_steps.rb
|
200
|
+
- features/step_definitions/rbd_steps.rb
|
183
201
|
- features/step_definitions/uricp_steps.rb
|
184
202
|
- features/support/env.rb
|
185
203
|
- features/userid_download.feature
|
@@ -205,7 +223,15 @@ files:
|
|
205
223
|
- lib/uricp/strategy/piped_local_put.rb
|
206
224
|
- lib/uricp/strategy/piped_rbd_get.rb
|
207
225
|
- lib/uricp/strategy/piped_remote_get.rb
|
208
|
-
- lib/uricp/strategy/
|
226
|
+
- lib/uricp/strategy/rbd_cache_base_snap.rb
|
227
|
+
- lib/uricp/strategy/rbd_cache_check.rb
|
228
|
+
- lib/uricp/strategy/rbd_cache_clone.rb
|
229
|
+
- lib/uricp/strategy/rbd_cache_upload.rb
|
230
|
+
- lib/uricp/strategy/rbd_cached_get.rb
|
231
|
+
- lib/uricp/strategy/rbd_cached_put.rb
|
232
|
+
- lib/uricp/strategy/rbd_flattener.rb
|
233
|
+
- lib/uricp/strategy/rbd_put.rb
|
234
|
+
- lib/uricp/strategy/rbd_snap.rb
|
209
235
|
- lib/uricp/strategy/rbd_sweeper.rb
|
210
236
|
- lib/uricp/strategy/remote_put.rb
|
211
237
|
- lib/uricp/strategy/segmented_remote_put.rb
|
@@ -240,12 +266,15 @@ summary: Copy one URL to another with optional cacheing
|
|
240
266
|
test_files:
|
241
267
|
- features/auth_download.feature
|
242
268
|
- features/cacheable_from_uri.feature
|
269
|
+
- features/check_uri_path.feature
|
243
270
|
- features/documented_options.feature
|
244
271
|
- features/qcow2_auth_download.feature
|
272
|
+
- features/rbd_access.feature
|
245
273
|
- features/remote_upload.feature
|
246
274
|
- features/segmented_upload.feature
|
247
275
|
- features/segmented_upload_options.feature
|
248
276
|
- features/step_definitions/orbit_steps.rb
|
277
|
+
- features/step_definitions/rbd_steps.rb
|
249
278
|
- features/step_definitions/uricp_steps.rb
|
250
279
|
- features/support/env.rb
|
251
280
|
- features/userid_download.feature
|