Skip to content

Commit

Permalink
Port changes from hashicorp/vagrant@7ccec33
Browse files Browse the repository at this point in the history
  • Loading branch information
legal90 committed Oct 23, 2014
1 parent f17d786 commit a094297
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
7 changes: 4 additions & 3 deletions lib/vagrant-parallels/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,9 @@ def self.action_simple_reboot
end
end

# This action sync folders on a running provider. It is used by the docker provider
# to link synced folders on the host machine as volumes into the docker containers
# This is the action that is called to sync folders to a running machine
# without a reboot. It is used by the docker provider to link synced
# folders on the host machine as volumes into the docker containers.
def self.action_sync_folders
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
Expand All @@ -320,7 +321,7 @@ def self.action_sync_folders
b2.use Message, I18n.t("vagrant.commands.common.vm_not_running")
next
end

b2.use PrepareNFSValidIds
b2.use SyncedFolders
b2.use PrepareNFSSettings
end
Expand Down
18 changes: 10 additions & 8 deletions lib/vagrant-parallels/action/prepare_nfs_settings.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
require 'ipaddr'
require "vagrant/action/builtin/mixin_synced_folders"

module VagrantPlugins
module Parallels
module Action
class PrepareNFSSettings
include Vagrant::Action::Builtin::MixinSyncedFolders
include Vagrant::Util::Retryable

def initialize(app, env)
Expand All @@ -15,19 +17,19 @@ def call(env)
@machine = env[:machine]
@app.call(env)

if using_nfs?(@machine.config.vm) || using_nfs?(env[:synced_folders_config])
opts = {
cached: !!env[:synced_folders_cached],
config: env[:synced_folders_config],
disable_usable_check: !!env[:test],
}
folders = synced_folders(env[:machine], **opts)

if folders.has_key?(:nfs)
@logger.info("Using NFS, preparing NFS settings by reading host IP and machine IP")
add_ips_to_env!(env)
end
end

# We're using NFS if we have any synced folder with NFS configured. If
# we are not using NFS we don't need to do the extra work to
# populate these fields in the environment.
def using_nfs?(env)
env && env.synced_folders.any? { |_, opts| opts[:type] == :nfs }
end

# Extracts the proper host and guest IPs for NFS mounts and stores them
# in the environment for the SyncedFolder action to use them in
# mounting.
Expand Down

0 comments on commit a094297

Please # to comment.