Class: RSpecSystem::NodeSet::VagrantVirtualbox

Inherits:
VagrantBase show all
Defined in:
lib/rspec-system/node_set/vagrant_virtualbox.rb

Overview

A NodeSet implementation for Vagrant.

Constant Summary collapse

PROVIDER_TYPE =
'vagrant_virtualbox'

Instance Attribute Summary

Attributes inherited from Base

#config, #custom_prefabs_path, #destroy, #nodes, #setname

Instance Method Summary collapse

Methods inherited from VagrantBase

#connect, #create_vagrantfile, #customize_vm, #global_vagrant_options, #initialize, #launch, #ssh_config, #teardown, #vagrant

Methods included from Util

#deep_merge!, #shellescape

Methods included from Log

#bold, #color, #formatter, #log, #output

Methods inherited from Base

#configure, #connect, #default_node, #initialize, #launch, #provider_type, #randmac, #random_string, #rcp, #run, #setup, #ssh_connect, #ssh_exec!, #teardown, #tmppath

Constructor Details

This class inherits a constructor from RSpecSystem::NodeSet::VagrantBase

Instance Method Details

#customize_provider(name, options) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Adds virtualbox customization to the Vagrantfile

Parameters:

  • name (String)

    name of the node

  • options (Hash)

    customization options

Returns:

  • (String)

    a series of vbox.customize lines



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rspec-system/node_set/vagrant_virtualbox.rb', line 25

def customize_provider(name,options)
  custom_config = ""
  options.each_pair do |key,value|
    next if global_vagrant_options.include?(key)
    case key
    when 'cpus','memory'
      custom_config << "    prov.customize ['modifyvm', :id, '--#{key}','#{value}']\n"
    when 'mac'
      custom_config << "    prov.customize ['modifyvm', :id, '--macaddress1','#{value}']\n"
    else
      log.warn("Skipped invalid custom option for node #{name}: #{key}=#{value}")
    end
  end
  custom_config
end

#vagrant_provider_nameString

Name of provider

Returns:

  • (String)

    name of the provider as used by ‘vagrant –provider`



15
16
17
# File 'lib/rspec-system/node_set/vagrant_virtualbox.rb', line 15

def vagrant_provider_name
  'virtualbox'
end