Sha256: 2d5101b684e81dcfddd7e0fd8c9c72d6610b82abb55df32d5da66b2a6835ce5a

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

require 'nexussw/lxd'
require 'tempfile'

module NexusSW
  module LXD
    class Transport
      def execute(_command, _options = {})
        raise "#{self.class}#execute not implemented"
      end

      def user(_user, _options = {})
        raise "#{self.class}#user not implemented"
      end

      def read_file(_path)
        raise "#{self.class}#read_file not implemented"
      end

      def write_file(_path, _content, _options = {})
        raise "#{self.class}#write_file not implemented"
      end

      def download_file(_path, _local_path)
        raise "#{self.class}#download_file not implemented"
      end

      def download_folder(_path, _local_path, _options = {})
        raise "#{self.class}#download_folder not implemented"
      end

      def upload_file(_local_path, _path, _options = {})
        raise "#{self.class}#upload_file not implemented"
      end

      def upload_folder(_local_path, _path, _options = {})
        raise "#{self.class}#upload_folder not implemented"
      end

      # kludge for windows environment
      def self.remote_tempname(basename)
        tfile = Tempfile.new(basename)
        "/tmp/#{File.basename tfile.path}"
      ensure
        tfile.unlink
      end

      def self.local_tempdir
        return ENV['TEMP'] unless !ENV['TEMP'] || ENV['TEMP'].empty?
        return ENV['TMP'] unless !ENV['TMP'] || ENV['TMP'].empty?
        return ENV['TMPDIR'] unless !ENV['TMPDIR'] || ENV['TMPDIR'].empty?
        '/tmp'
      end

      def self.chdir_mutex
        @chdir_mutex ||= Mutex.new
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lxd-common-0.9.8 lib/nexussw/lxd/transport.rb
lxd-common-0.9.7 lib/nexussw/lxd/transport.rb
lxd-common-0.9.6 lib/nexussw/lxd/transport.rb
lxd-common-0.9.5 lib/nexussw/lxd/transport.rb