Sha256: e12dd65d709231f81f0200ddd3e9865e2d68e56563036d8d1a38c22802ef31ed

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

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)
          if env[:machine].state.id != :running
            fail Errors::MachineNotRunning,
                 :machine_name => env[:machine].name
          end

          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

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-vcenter-0.3.3 lib/vagrant-vcenter/action/prepare_nfs_settings.rb