Class: Vagrant::Action::VM::MatchMACAddress
- Inherits:
-
Object
- Object
- Vagrant::Action::VM::MatchMACAddress
- Defined in:
- lib/vagrant/action/vm/match_mac_address.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ MatchMACAddress
constructor
A new instance of MatchMACAddress.
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 18 19 20 21 22 |
# File 'lib/vagrant/action/vm/match_mac_address.rb', line 9 def call(env) raise Errors::VMBaseMacNotSpecified if !env.env.config.vm.base_mac # Create the proc which we want to use to modify the virtual machine proc = lambda do |vm| env.ui.info I18n.t("vagrant.actions.vm.match_mac.matching") vm.network_adapters.first.mac_address = env["config"].vm.base_mac end # Add the proc to the modification chain env["vm.modify"].call(proc) @app.call(env) end |