Sha256: 1f9d4e96bef91cb25f41bbd0478e5b245726b8af23c08e61bf5a1b5a7ead013e

Contents?: true

Size: 810 Bytes

Versions: 7

Compression:

Stored size: 810 Bytes

Contents

# frozen_string_literal: true

require 'json'
module Uricp::Strategy
  class PipedRbdGet
    include Uricp::Strategy::Common
    include Uricp::Strategy::CacheCommon

    def appropriate?
      without_active_cache do
        if from.scheme == 'rbd' &&
           rbd_snapshot_spec?(from) &&
           to.scheme != 'rbd' &&
           (!conversion_required? || raw_target?) &&
           !sequence_complete?
          return proposal
        end
      end
      debug "#{self.class.name}: not appropriate"
      false
    end

    def command
      "rbd export --no-progress --id #{rbd_id} '#{rbd_image_spec(from)}' - |"
    end

    def proposal
      @proposed_options = options.dup
      @proposed_options['from_uri'] = PIPE_URI
      @proposed_options.delete('target-format')
      self
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
uricp-0.0.37 lib/uricp/strategy/piped_rbd_get.rb
uricp-0.0.36 lib/uricp/strategy/piped_rbd_get.rb
uricp-0.0.35 lib/uricp/strategy/piped_rbd_get.rb
uricp-0.0.34 lib/uricp/strategy/piped_rbd_get.rb
uricp-0.0.32 lib/uricp/strategy/piped_rbd_get.rb
uricp-0.0.31 lib/uricp/strategy/piped_rbd_get.rb
uricp-0.0.30 lib/uricp/strategy/piped_rbd_get.rb