Class: Vagrant::Plugin::V1::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/plugin/v1/provider.rb

Overview

This is the base class for a provider for the V1 API. A provider is responsible for creating compute resources to match the needs of a Vagrant-configured system.

Instance Method Summary collapse

Constructor Details

#initialize(machine) ⇒ Provider

Initialize the provider to represent the given machine.

Parameters:

  • machine (Vagrant::Machine)

    The machine that this provider is responsible for.



15
16
# File 'lib/vagrant/plugin/v1/provider.rb', line 15

def initialize(machine)
end

Instance Method Details

#action(name) ⇒ Object

This should return an action callable for the given name.

Parameters:

  • name (Symbol)

    Name of the action.

Returns:

  • (Object)

    A callable action sequence object, whether it is a proc, object, etc.



23
24
25
# File 'lib/vagrant/plugin/v1/provider.rb', line 23

def action(name)
  nil
end

#machine_id_changedObject

This method is called if the underlying machine ID changes. Providers can use this method to load in new data for the actual backing machine or to realize that the machine is now gone (the ID can become nil). No parameters are given, since the underlying machine is simply the machine instance given to this object. And no return value is necessary.



33
34
# File 'lib/vagrant/plugin/v1/provider.rb', line 33

def machine_id_changed
end

#ssh_infoHash

This should return a hash of information that explains how to SSH into the machine. If the machine is not at a point where SSH is even possible, then nil should be returned.

The general structure of this returned hash should be the following:

{
  host: "1.2.3.4",
  port: "22",
  username: "mitchellh",
  private_key_path: "/path/to/my/key"
}

Note: Vagrant only supports private key based authentication, mainly for the reason that there is no easy way to exec into an ssh prompt with a password, whereas we can pass a private key via commandline.

Returns:

  • (Hash)

    SSH information. For the structure of this hash read the accompanying documentation for this method.



57
58
59
# File 'lib/vagrant/plugin/v1/provider.rb', line 57

def ssh_info
  nil
end

#stateSymbol

This should return the state of the machine within this provider. The state can be any symbol.

Returns:

  • (Symbol)


65
66
67
# File 'lib/vagrant/plugin/v1/provider.rb', line 65

def state
  nil
end