Sha256: 6ab1d7f16e220742c1fb7a496387d52ccebf2a7ffb8d5de151d23ea66e9decde

Contents?: true

Size: 570 Bytes

Versions: 3

Compression:

Stored size: 570 Bytes

Contents

require 'socket'

module VagrantPlugins
  module VCenter
    module Action
      class PrepareNFSSettings
        include Vagrant::Util::Retryable

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

        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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-vcenter-0.3.2 lib/vagrant-vcenter/action/prepare_nfs_settings.rb
vagrant-vcenter-0.3.1 lib/vagrant-vcenter/action/prepare_nfs_settings.rb
vagrant-vcenter-0.3.0 lib/vagrant-vcenter/action/prepare_nfs_settings.rb