providers/docker: only correct port collisions if not host VM

This commit is contained in:
Mitchell Hashimoto 2014-04-17 14:22:41 -07:00
parent 58a043e2aa
commit 6ea6ad3e08
2 changed files with 26 additions and 1 deletions

View File

@ -16,7 +16,6 @@ module VagrantPlugins
# If the VM is NOT created yet, then do the setup steps
if env[:result]
b2.use EnvSet, :port_collision_repair => true
b2.use HandleForwardedPortCollisions
b2.use Call, HasSSH do |env2, b3|
if env2[:result]
@ -28,6 +27,14 @@ module VagrantPlugins
end
end
b2.use Call, HostMachineRequired do |env2, b3|
if !env[:result]
# We're not using a proxy host VM, so just handle
# port collisions like we would any other system.
b3.use HandleForwardedPortCollisions
end
end
b2.use PrepareNFSValidIds
b2.use SyncedFolderCleanup
b2.use SyncedFolders
@ -220,6 +227,7 @@ module VagrantPlugins
autoload :ForwardPorts, action_root.join("forward_ports")
autoload :HasSSH, action_root.join("has_ssh")
autoload :HostMachine, action_root.join("host_machine")
autoload :HostMachineRequired, action_root.join("host_machine_required")
autoload :HostMachineSyncFolders, action_root.join("host_machine_sync_folders")
autoload :HostMachineSyncFoldersDisable, action_root.join("host_machine_sync_folders_disable")
autoload :PrepareSSH, action_root.join("prepare_ssh")

View File

@ -0,0 +1,17 @@
module VagrantPlugins
module DockerProvider
module Action
# This middleware is used with Call to test if we're using a host VM.
class HostMachineRequired
def initialize(app, env)
@app = app
end
def call(env)
env[:result] = env[:machine].provider.host_vm?
@app.call(env)
end
end
end
end
end