Sha256: 833cfc2e38fe1635a2dec6cfaf97597f7f7126c2a0cf73bb72e4e55c927435a4

Contents?: true

Size: 772 Bytes

Versions: 3

Compression:

Stored size: 772 Bytes

Contents

module Uricp::Strategy
  class RbdRemotePut
    include Uricp::Strategy::Common

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

    def command
      "rbd import --no-progress --id #{rbd_id} #{data_source} '#{rbd_target(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

3 entries across 3 versions & 1 rubygems

Version Path
uricp-0.0.18 lib/uricp/strategy/rbd_remote_put.rb
uricp-0.0.17 lib/uricp/strategy/rbd_remote_put.rb
uricp-0.0.16 lib/uricp/strategy/rbd_remote_put.rb