Sha256: b61e28549747ae4acdb3b16c32c2ce230374723923b63451ef5c6ffa7419fae2

Contents?: true

Size: 816 Bytes

Versions: 4

Compression:

Stored size: 816 Bytes

Contents

module Uricp::Strategy
  class RbdPut
    include Uricp::Strategy::Common

    def appropriate?
      if compression_required? || conversion_required?
        debug "#{self.class.name}: not ready to upload"
        return false
      end
      unless rbd_cache_name
        case from.scheme
        when 'pipe', 'file'
          return proposal if to.scheme == 'rbd'
        end
      end
      debug "#{self.class.name}: not appropriate"
      false
    end

    def command
      "rbd import --no-progress --id #{rbd_id} #{data_source} '#{rbd_image_spec(to)}';"
    end

    def proposal
      @proposed_options = options.dup
      @proposed_options['from_uri'] = to
      self
    end

    def data_source
      if from.scheme == 'pipe'
        '-'
      else
        "'#{from.path}'"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
uricp-0.0.23 lib/uricp/strategy/rbd_put.rb
uricp-0.0.22 lib/uricp/strategy/rbd_put.rb
uricp-0.0.21 lib/uricp/strategy/rbd_put.rb
uricp-0.0.20 lib/uricp/strategy/rbd_put.rb