providers/docker: SSH extra args go to Docker container [GH-4378]

This commit is contained in:
Mitchell Hashimoto 2014-08-29 11:11:53 -07:00
parent 5eaa8ca597
commit b4345968a5
2 changed files with 9 additions and 7 deletions

View File

@ -48,6 +48,7 @@ BUG FIXES:
reprovision. [GH-4393]
- commands/package: base package won't crash with exception [GH-4017]
- commands/rsync-auto: Destroyed machines won't raise exceptions. [GH-4031]
- commands/ssh: Extra args are passed through to Docker container. [GH-4378]
- communicators/ssh: Nicer error if remote unexpectedly disconects. [GH-4038]
- communicators/ssh: Clean error when max sessions is hit. [GH-4044]
- communicators/ssh: Fix many issues around PTY-enabled output parsing.

View File

@ -19,14 +19,15 @@ module VagrantPlugins
# Modify the SSH options for when we `vagrant ssh`...
ssh_opts = env[:ssh_opts] || {}
# Append "-t" to force a TTY allocation
ssh_opts[:extra_args] = Array(ssh_opts[:extra_args])
ssh_opts[:extra_args] << "-t"
# Build the command we'll execute within the host machine
ssh_command = env[:machine].communicate.container_ssh_command
if !Array(ssh_opts[:extra_args]).empty?
ssh_command << " #{Array(ssh_opts[:extra_args]).join(" ")}"
end
# Append our real SSH command. If we have a host VM we know
# we're using our special communicator, so we can call helpers there
ssh_opts[:extra_args] <<
env[:machine].communicate.container_ssh_command
# Append "-t" to force a TTY allocation
ssh_opts[:extra_args] = ["-t"]
ssh_opts[:extra_args] << ssh_command
# Set the opts
env[:ssh_opts] = ssh_opts