Sha256: 84793ee36b2e82a1be45f29c0d3b089ed19054cb76d2ec73fbce75ad7fd9dd3a

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

require 'fileutils'
require 'systemu'
require 'net/ssh'
require 'net/scp'
require 'rspec-system/node_set/vagrant_base'

module RSpecSystem
  # A NodeSet implementation for Vagrant.
  class NodeSet::VagrantVirtualbox < NodeSet::VagrantBase
    PROVIDER_TYPE = 'vagrant_virtualbox'

    # Name of provider
    #
    # @return [String] name of the provider as used by `vagrant --provider`
    def vagrant_provider_name
      'virtualbox'
    end

    # Adds virtualbox customization to the Vagrantfile
    #
    # @api private
    # @param name [String] name of the node
    # @param options [Hash] customization options
    # @return [String] a series of vbox.customize lines
    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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-system-2.8.0 lib/rspec-system/node_set/vagrant_virtualbox.rb
rspec-system-2.7.2 lib/rspec-system/node_set/vagrant_virtualbox.rb
rspec-system-2.7.1 lib/rspec-system/node_set/vagrant_virtualbox.rb
rspec-system-2.7.0 lib/rspec-system/node_set/vagrant_virtualbox.rb
rspec-system-2.6.0 lib/rspec-system/node_set/vagrant_virtualbox.rb