providers/docker: only correct port collisions if not host VM
This commit is contained in:
parent
58a043e2aa
commit
6ea6ad3e08
|
@ -16,7 +16,6 @@ module VagrantPlugins
|
||||||
# If the VM is NOT created yet, then do the setup steps
|
# If the VM is NOT created yet, then do the setup steps
|
||||||
if env[:result]
|
if env[:result]
|
||||||
b2.use EnvSet, :port_collision_repair => true
|
b2.use EnvSet, :port_collision_repair => true
|
||||||
b2.use HandleForwardedPortCollisions
|
|
||||||
|
|
||||||
b2.use Call, HasSSH do |env2, b3|
|
b2.use Call, HasSSH do |env2, b3|
|
||||||
if env2[:result]
|
if env2[:result]
|
||||||
|
@ -28,6 +27,14 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
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 PrepareNFSValidIds
|
||||||
b2.use SyncedFolderCleanup
|
b2.use SyncedFolderCleanup
|
||||||
b2.use SyncedFolders
|
b2.use SyncedFolders
|
||||||
|
@ -220,6 +227,7 @@ module VagrantPlugins
|
||||||
autoload :ForwardPorts, action_root.join("forward_ports")
|
autoload :ForwardPorts, action_root.join("forward_ports")
|
||||||
autoload :HasSSH, action_root.join("has_ssh")
|
autoload :HasSSH, action_root.join("has_ssh")
|
||||||
autoload :HostMachine, action_root.join("host_machine")
|
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 :HostMachineSyncFolders, action_root.join("host_machine_sync_folders")
|
||||||
autoload :HostMachineSyncFoldersDisable, action_root.join("host_machine_sync_folders_disable")
|
autoload :HostMachineSyncFoldersDisable, action_root.join("host_machine_sync_folders_disable")
|
||||||
autoload :PrepareSSH, action_root.join("prepare_ssh")
|
autoload :PrepareSSH, action_root.join("prepare_ssh")
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue