Class: Vagrant::Action::VM::MatchMACAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/action/vm/match_mac_address.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ MatchMACAddress

Returns a new instance of MatchMACAddress.



5
6
7
# File 'lib/vagrant/action/vm/match_mac_address.rb', line 5

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/vagrant/action/vm/match_mac_address.rb', line 9

def call(env)
  raise Errors::VMBaseMacNotSpecified if !env.env.config.vm.base_mac

  env.ui.info I18n.t("vagrant.actions.vm.match_mac.matching")
  env["vm"].vm.network_adapters.first.mac_address = env.env.config.vm.base_mac
  env["vm"].vm.save

  @app.call(env)
end