providers/docker: pty flag, not functional yet

This commit is contained in:
Mitchell Hashimoto 2014-04-29 15:51:32 -07:00
parent ca5651a0b1
commit e90e45a8fb
3 changed files with 13 additions and 1 deletions

View File

@ -26,6 +26,9 @@ module VagrantPlugins
# No ports should be shared to the host # No ports should be shared to the host
params[:ports] = [] params[:ports] = []
# Allocate a pty if it was requested
params[:pty] = true if env[:run_pty]
# We link to our original container # We link to our original container
# TODO # TODO
end end
@ -94,6 +97,7 @@ module VagrantPlugins
name: container_name, name: container_name,
ports: forwarded_ports, ports: forwarded_ports,
privileged: @provider_config.privileged, privileged: @provider_config.privileged,
pty: false,
volumes: @provider_config.volumes, volumes: @provider_config.volumes,
} }
end end

View File

@ -9,6 +9,7 @@ module VagrantPlugins
def execute def execute
options = {} options = {}
options[:detach] = false options[:detach] = false
options[:pty] = false
opts = OptionParser.new do |o| opts = OptionParser.new do |o|
o.banner = "Usage: vagrant docker-run [command...]" o.banner = "Usage: vagrant docker-run [command...]"
@ -19,6 +20,10 @@ module VagrantPlugins
o.on("--[no-]detach", "Run in the background") do |d| o.on("--[no-]detach", "Run in the background") do |d|
options[:detach] = d options[:detach] = d
end end
o.on("-t", "--[no-]tty", "Allocate a pty") do |t|
options[:pty] = t
end
end end
# Parse out the extra args to send to SSH, which is everything # Parse out the extra args to send to SSH, which is everything
@ -41,7 +46,9 @@ module VagrantPlugins
machine.action( machine.action(
:run_command, :run_command,
run_command: command, run_command: command,
run_detach: options[:detach]) run_detach: options[:detach],
run_pty: options[:pty],
)
end end
0 0

View File

@ -44,6 +44,7 @@ module VagrantPlugins
run_cmd += volumes.map { |v| ['-v', v.to_s] } run_cmd += volumes.map { |v| ['-v', v.to_s] }
run_cmd += %W(--privileged) if params[:privileged] run_cmd += %W(--privileged) if params[:privileged]
run_cmd += %W(-h #{params[:hostname]}) if params[:hostname] run_cmd += %W(-h #{params[:hostname]}) if params[:hostname]
run_cmd << "-t" if params[:pty]
run_cmd += params[:extra_args] if params[:extra_args] run_cmd += params[:extra_args] if params[:extra_args]
run_cmd += [image, cmd] run_cmd += [image, cmd]