Class: Vagrant::Plugin::V1::Host

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

Overview

Base class for a host in Vagrant. A host class contains functionality that is specific to a specific OS that is running Vagrant. This abstraction is done because there is some host-specific logic that Vagrant must do in some cases.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ui) ⇒ Host

Initializes a new host class.

The only required parameter is a UI object so that the host objects have some way to communicate with the outside world.

Parameters:

  • ui (UI)

    UI for the hosts to output to.



37
38
39
# File 'lib/vagrant/plugin/v1/host.rb', line 37

def initialize(ui)
  @ui = ui
end

Class Method Details

.match?Boolean

This returns true/false depending on if the current running system matches the host class.

Returns:

  • (Boolean)


16
17
18
# File 'lib/vagrant/plugin/v1/host.rb', line 16

def self.match?
  nil
end

.precedenceObject

The precedence of the host when checking for matches. This is to allow certain host such as generic OS's ("Linux", "BSD", etc.) to be specified last.

The hosts with the higher numbers will be checked first.

If you're implementing a basic host, you can probably ignore this.



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

def self.precedence
  5
end

Instance Method Details

#nfs?Boolean

Returns true of false denoting whether or not this host supports NFS shared folder setup. This method ideally should verify that NFS is installed.

Returns:

  • (Boolean)


46
47
48
# File 'lib/vagrant/plugin/v1/host.rb', line 46

def nfs?
  false
end

#nfs_export(id, ip, folders) ⇒ Object

Exports the given hash of folders via NFS.

Parameters:

  • id (String)

    A unique ID that is guaranteed to be unique to match these sets of folders.

  • ip (String)

    IP of the guest machine.

  • folders (Hash)

    Shared folders to sync.



56
57
# File 'lib/vagrant/plugin/v1/host.rb', line 56

def nfs_export(id, ip, folders)
end

#nfs_prune(valid_ids) ⇒ Object

Prunes any NFS exports made by Vagrant which aren't in the set of valid ids given.

Parameters:

  • valid_ids (Array<String>)

    Valid IDs that should not be pruned.



64
65
# File 'lib/vagrant/plugin/v1/host.rb', line 64

def nfs_prune(valid_ids)
end