core: execute SSH commands in context of login shell [GH-2636]

This commit is contained in:
Mitchell Hashimoto 2013-12-13 21:02:00 -08:00
parent 4bf1808fde
commit a55a53e6a4
2 changed files with 9 additions and 1 deletions

View File

@ -10,6 +10,8 @@ IMPROVEMENTS:
BUG FIXES: BUG FIXES:
- core: box removal of a V1 box works - core: box removal of a V1 box works
- core: `vagrant ssh -c` commands are now executed in the context of
a login shell (regression). [GH-2636]
- guests/debian: fix `use_dhcp_assigned_default_route` to work properly. - guests/debian: fix `use_dhcp_assigned_default_route` to work properly.
[GH-2648] [GH-2648]
- guests/debian,ubuntu: fix change\_host\_name for FQDNs with trailing - guests/debian,ubuntu: fix change\_host\_name for FQDNs with trailing

View File

@ -32,8 +32,14 @@ module Vagrant
end end
end end
# Execute! # Get the command and wrap it in a login shell
command = env[:ssh_run_command] command = env[:ssh_run_command]
command = command.gsub(/'/) do |m|
"#{m}\\#{m}#{m}"
end
command = "#{env[:machine].config.ssh.shell} -c '#{command}'"
# Execute!
opts = env[:ssh_opts] || {} opts = env[:ssh_opts] || {}
opts[:extra_args] = ["-t", command] opts[:extra_args] = ["-t", command]
opts[:subprocess] = true opts[:subprocess] = true