uricp 0.0.23 → 0.0.24

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f12b0071b707cd164565e756677d620c77aa4433161b28b4e2aed90e764f2e68
4
- data.tar.gz: 2a226104ffad1d51b15e6a9ea015d94e058ff7728e66d3f0c708092e1764205b
3
+ metadata.gz: ff143aca9aad2f48ac2948322959e24a421b95cd04cb545a8921f18e601139f0
4
+ data.tar.gz: 719d814583ab1513f10bbc04f6c8487c0fb803a6ab8fb4a307de6c1bf6d7c39a
5
5
  SHA512:
6
- metadata.gz: 420a3273588f2fde0d78b12250be89b0c07fc0f82d9e4101c427780f871f021bba870ff88b14d5adf3dd9ed0c599a944474137040e8ea2f07aaadd326fa6eccc
7
- data.tar.gz: 6cba1806fed37f14d5dad8402061f639f9d6e32df79caf66bd06c2bbabcbd68d460b71710ba76f676967301a1b878129b8b92bd7796f697f8159cc9a65da3c89
6
+ metadata.gz: 78a4cab2edab9ef6ca65a483dc5fe5cad0b221bfd170f891812af0c5883ae11e9b64e60b49be535fc41829d91f21820016c5fcfb94850c83487b0dcb4ba9c36b
7
+ data.tar.gz: 740916783658e36e3346eda72ea799a7a35e58da3cbb40619516c2f788de343c72a976c95229d85beccd5e9a3b5afcc1ebc85b726ed5cc6e85c2a9723877efaf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- uricp (0.0.23)
4
+ uricp (0.0.24)
5
5
  childprocess (~> 1.0)
6
6
  filesize (= 0.0.2)
7
7
  methadone (~> 2.0.2)
@@ -2,6 +2,7 @@ module Uricp::Strategy
2
2
  module Common
3
3
  include Methadone::CLILogging
4
4
  include Uricp::CurlPrimitives
5
+ include Methadone::SH
5
6
 
6
7
  def initialize(options)
7
8
  @options = options
@@ -158,6 +159,10 @@ module Uricp::Strategy
158
159
  uri.scheme == 'rbd' && uri.path.include?('@')
159
160
  end
160
161
 
162
+ def rbd_cache_upload_available?
163
+ rbd_cache_name && !rbd_cache_image_exists?(rbd_cache_name)
164
+ end
165
+
161
166
  def rbd_cache_image_exists?(target)
162
167
  command = "rbd status --id #{rbd_id} --format json #{target} 2>/dev/null"
163
168
  if dry_run?
@@ -4,7 +4,6 @@ module Uricp::Strategy
4
4
  class PipedCache
5
5
  include Uricp::Strategy::Common
6
6
  include Uricp::Strategy::CacheCommon
7
- include Methadone::SH
8
7
 
9
8
  def appropriate?
10
9
  with_active_cache do
@@ -26,7 +25,7 @@ module Uricp::Strategy
26
25
  @proposed_options = options.dup
27
26
  @proposed_options['sweep'] = [temp_cache_file, cache_file]
28
27
  image_spec_to_check = rbd_cache_image_spec(to)
29
- if to.scheme == 'rbd' && !rbd_cache_image_exists?(image_spec_to_check)
28
+ if to.scheme == 'rbd'
30
29
  @proposed_options['rbd_cache_name'] = image_spec_to_check
31
30
  end
32
31
  @proposed_options.delete('cache')
@@ -3,7 +3,6 @@ module Uricp::Strategy
3
3
  class PipedRbdGet
4
4
  include Uricp::Strategy::Common
5
5
  include Uricp::Strategy::CacheCommon
6
- include Methadone::SH
7
6
 
8
7
  def appropriate?
9
8
  without_active_cache do
@@ -1,7 +1,6 @@
1
1
  module Uricp::Strategy
2
2
  class RbdCacheBaseSnap
3
3
  include Uricp::Strategy::Common
4
- include Methadone::SH
5
4
 
6
5
  def appropriate?
7
6
  if rbd_cache_name &&
@@ -4,7 +4,6 @@ module Uricp::Strategy
4
4
  class RbdCacheCheck
5
5
  include Uricp::Strategy::Common
6
6
  include Uricp::Strategy::CacheCommon
7
- include Methadone::SH
8
7
 
9
8
  def appropriate?
10
9
  unless (from.scheme == 'rbd') != (to.scheme == 'rbd')
@@ -4,7 +4,6 @@ module Uricp::Strategy
4
4
  class RbdCacheClone
5
5
  include Uricp::Strategy::Common
6
6
  include Uricp::Strategy::CacheCommon
7
- include Methadone::SH
8
7
 
9
8
  def appropriate?
10
9
  unless from.scheme == 'rbd'
@@ -1,14 +1,13 @@
1
1
  module Uricp::Strategy
2
2
  class RbdCacheUpload
3
3
  include Uricp::Strategy::Common
4
- include Methadone::SH
5
4
 
6
5
  def appropriate?
7
6
  if compression_required? || conversion_required?
8
7
  debug "#{self.class.name}: not ready to upload"
9
8
  return false
10
9
  end
11
- if rbd_cache_name
10
+ if rbd_cache_upload_available?
12
11
  case from.scheme
13
12
  when 'pipe', 'file'
14
13
  return proposal if to.scheme == 'rbd'
@@ -4,7 +4,6 @@ module Uricp::Strategy
4
4
  class RbdCachedGet
5
5
  include Uricp::Strategy::Common
6
6
  include Uricp::Strategy::CacheCommon
7
- include Methadone::SH
8
7
 
9
8
  def appropriate?
10
9
  if from.scheme != 'rbd' || rbd_snapshot_spec?(from)
@@ -7,11 +7,13 @@ module Uricp::Strategy
7
7
  debug "#{self.class.name}: not ready to upload"
8
8
  return false
9
9
  end
10
- unless rbd_cache_name
11
- case from.scheme
12
- when 'pipe', 'file'
13
- return proposal if to.scheme == 'rbd'
14
- end
10
+ if rbd_cache_upload_available?
11
+ debug "#{self.class.name}: cacheing in RBD instead"
12
+ return false
13
+ end
14
+ case from.scheme
15
+ when 'pipe', 'file'
16
+ return proposal if to.scheme == 'rbd'
15
17
  end
16
18
  debug "#{self.class.name}: not appropriate"
17
19
  false
@@ -3,7 +3,6 @@ module Uricp::Strategy
3
3
  class RbdSnap
4
4
  include Uricp::Strategy::Common
5
5
  include Uricp::Strategy::CacheCommon
6
- include Methadone::SH
7
6
 
8
7
  def appropriate?
9
8
  without_active_cache do
data/lib/uricp/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uricp
4
- VERSION = '0.0.23'
4
+ VERSION = '0.0.24'
5
5
  DEFAULT_SEGMENT_SIZE = '5 GiB'
6
6
  end
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.23
4
+ version: 0.0.24
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-09-27 00:00:00.000000000 Z
11
+ date: 2021-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler