Sha256: b16d44a39280e5da1a3c84314101c812f3e94671fccbe376dab71cafe882368c
Contents?: true
Size: 1.08 KB
Versions: 15
Compression:
Stored size: 1.08 KB
Contents
module VagrantPlugins module Skytap module Action class PrepareNFSSettings attr_reader :env, :machine def initialize(app,env) @app = app @env = env @logger = Log4r::Logger.new("vagrant_skytap::action::prepare_nfs_settings") end def call(env) @machine = env[:machine] if using_nfs? env[:nfs_host_ip] = read_host_ip env[:nfs_machine_ip] = read_machine_ip end @app.call(env) end def using_nfs? @machine.config.vm.synced_folders.any? { |_, opts| opts[:type] == :nfs } end # Returns the IP address of the host, preferring one on an interface which # the client can route to. def read_host_ip UDPSocket.open do |s| s.connect(machine.ssh_info[:host], 1) s.addr.last end.tap do |ret| @logger.debug "read_host_ip returning #{ret}" end end def read_machine_ip machine.ssh_info[:host] end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems