Module: Vagrant::Host::Remote

Defined in:
lib/vagrant/host/remote.rb

Overview

This module enables Host for server mode

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(klass) ⇒ Object

Add an attribute accesor for the client when applied to the Guest class



11
12
13
14
15
# File 'lib/vagrant/host/remote.rb', line 11

def self.prepended(klass)
  klass.class_eval do
    attr_accessor :client
  end
end

Instance Method Details

#capability(cap_name, *args) ⇒ Object

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.

Parameters:

  • cap_name (Symbol)

    Name of the capability



36
37
38
39
# File 'lib/vagrant/host/remote.rb', line 36

def capability(cap_name, *args)
  @logger.debug("running remote host capability #{cap_name} with args #{args}")
  client.capability(cap_name, *args)
end

#capability?(cap_name) ⇒ Boolean

Tests whether the given capability is possible.

Parameters:

  • cap_name (Symbol)

    Capability name

Returns:

  • (Boolean)


45
46
47
48
# File 'lib/vagrant/host/remote.rb', line 45

def capability?(cap_name)
  @logger.debug("checking for remote host capability #{cap_name}")
  client.has_capability?(cap_name)
end

#initialize(host, hosts, capabilities, env) ⇒ Object

Parameters:



21
22
23
24
25
# File 'lib/vagrant/host/remote.rb', line 21

def initialize(host, hosts, capabilities, env)
  @env = env
  @client = host
  @logger = Log4r::Logger.new("vagrant::host")
end

#initialize_capabilities!(host, hosts, capabilities, *args) ⇒ Object



27
28
29
# File 'lib/vagrant/host/remote.rb', line 27

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

#to_protoObject



50
51
52
# File 'lib/vagrant/host/remote.rb', line 50

def to_proto
  client.proto
end