Class: HashiCorp::VagrantVMwareDesktop::Action::CheckExistingNetwork

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/vagrant-vmware-desktop/action/check_existing_network.rb

Overview

This class checks that the existing network interfaces are all properly running and are happy, and shows an error otherwise.

Instance Method Summary collapse

Methods included from Common

#to_s

Constructor Details

#initialize(app, env) ⇒ CheckExistingNetwork

Returns a new instance of CheckExistingNetwork.



13
14
15
16
# File 'lib/vagrant-vmware-desktop/action/check_existing_network.rb', line 13

def initialize(app, env)
  @app    = app
  @logger = Log4r::Logger.new("hashicorp::provider::vmware::check_existing_network")
end

Instance Method Details

#call(env) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant-vmware-desktop/action/check_existing_network.rb', line 18

def call(env)
  if env[:machine].provider_config.verify_vmnet
    @logger.info("Checking if the vmnet devices are healthy...")
    Helper::Lock.lock(env[:machine], "vmware-network") do
      env[:ui].info(I18n.t("hashicorp.vagrant_vmware_desktop.verifying_vmnet"))
      env[:machine].provider.driver.verify_vmnet!
    end
  else
    @logger.info("Skipping vmnet device verificiation, vmnet_verify option is false.")
    env[:ui].info(I18n.t("hashicorp.vagrant_vmware_desktop.skipping_vmnet_verify"))
  end

  @app.call(env)
end