Sha256: 93f8028933a0c520d0758b2ade82347182b96fa45f81169654c69045380a0671

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

require 'timeout'
require 'log4r'
require_relative '../errors'

module VagrantPluginDummy
  module Communication
    # Provides no communication with the machine.
    class DummyCommunicator < Vagrant.plugin("2", :communicator)

      attr_reader :logger
      attr_reader :machine

      def self.match?(machine)
        machine.config.vm.guest.eql? :dummy
      end

      def initialize(machine)
        @machine = machine
        @logger = Log4r::Logger.new("vagrant_plugin_dummy::communication::dummycommunicator")
        @logger.debug("initializing DummyCommunicator")
      end

      def ready?
        @logger.warn("Assuming the machine is ready.")
        return true
      end

      def execute(command, opts={}, &block)
        @logger.warn("DummyCommunicator.execute isn't implemented")
        return 0
      end
      alias_method :sudo, :execute

      def test(command, opts=nil)
        return false unless @machine.config.vm.guest.eql? :dummy
      end

      def upload(from, to)
        @logger.warn("DummyCommunicator.upload isn't implemented")
      end

      def download(from, to=nil)
        @logger.warn("DummyCommunicator.download isn't implemented")
      end

      def session
        @session ||= new_session
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-plugin-dummy-0.0.1 lib/vagrant-plugin-dummy/communication/communicator.rb
vagrant-plugin-dummy-0.0.2 lib/vagrant-plugin-dummy/communication/communicator.rb