Class: VagrantPlugins::VCenter::Action::PrepareNFSSettings

Inherits:
Object
  • Object
show all
Includes:
Vagrant::Util::Retryable
Defined in:
lib/vagrant-vcenter/action/prepare_nfs_settings.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ PrepareNFSSettings

Returns a new instance of PrepareNFSSettings.



9
10
11
12
# File 'lib/vagrant-vcenter/action/prepare_nfs_settings.rb', line 9

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new('vagrant_vcenter::action::nfs')
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/vagrant-vcenter/action/prepare_nfs_settings.rb', line 14

def call(env)
  host_ip = Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address

  @logger.debug("Setting host_ip to #{host_ip}")

  env[:nfs_host_ip]    = host_ip
  @app.call env
end