Sha256: 63c4237d80523a9e99f09c50521e9e96604e5a5cbcd9c454dd91b54e84882003

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

module Vagrant
  class Host
    # This module enables Host for server mode
    module Remote

      # Add an attribute accesor for the client
      # when applied to the Guest class
      def self.prepended(klass)
        klass.class_eval do
          attr_accessor :client
        end
      end

      # @param [] host client
      # @param hosts - unused
      # @param capabilities - unused
      # @param [Vagrant::Environment]
      def initialize(host, hosts, capabilities, env)
        @env = env
        @client = host
        @logger = Log4r::Logger.new("vagrant::host")
      end

      def initialize_capabilities!(host, hosts, capabilities, *args)
        # no-op
      end

      # Executes the capability with the given name, optionally passing more
      # arguments onwards to the capability. If the capability returns a value,
      # it will be returned.
      #
      # @param [Symbol] cap_name Name of the capability
      def capability(cap_name, *args)
        @logger.debug("running remote host capability #{cap_name} with args #{args}")
        client.capability(cap_name, *args)
      end

      # Tests whether the given capability is possible.
      #
      # @param [Symbol] cap_name Capability name
      # @return [Boolean]
      def capability?(cap_name)
        @logger.debug("checking for remote host capability #{cap_name}")
        client.has_capability?(cap_name)
      end

      def to_proto
        client.proto
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vagrant-unbundled-2.3.6.0 lib/vagrant/host/remote.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/lib/vagrant/host/remote.rb
vagrant-unbundled-2.3.3.0 lib/vagrant/host/remote.rb
vagrant-unbundled-2.3.2.0 lib/vagrant/host/remote.rb