Merge pull request #96 from erik-smit/remote-libvirt-ssh

Proxy ssh through libvirt host, if libvirt is connected via ssh
This commit is contained in:
Dmitry Vasilets 2013-12-03 11:53:27 -08:00
commit dc18b14880
2 changed files with 4 additions and 1 deletions

View File

@ -47,6 +47,8 @@ module VagrantPlugins
:forward_agent => machine.config.ssh.forward_agent,
:forward_x11 => machine.config.ssh.forward_x11,
}
ssh_info[:proxy_command] = "ssh '#{machine.provider_config.host}' -l '#{machine.provider_config.username}' nc %h %p" if machine.provider_config.connect_via_ssh
if not ssh_info[:username]
ssh_info[:username] = machine.config.ssh.default.username

View File

@ -19,6 +19,7 @@ module VagrantPlugins
env[:machine].config.vm.synced_folders.each do |id, data|
next if data[:nfs]
proxycommand = "-o ProxyCommand='#{ssh_info[:proxy_command]}'" if ssh_info[:proxy_command]
hostpath = File.expand_path(data[:hostpath], env[:root_path])
guestpath = data[:guestpath]
@ -39,7 +40,7 @@ module VagrantPlugins
command = [
"rsync", "--del", "--verbose", "--archive", "-z",
"--exclude", ".vagrant/",
"-e", "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no -i '#{ssh_info[:private_key_path]}'",
"-e", "ssh -p #{ssh_info[:port]} #{proxycommand} -o StrictHostKeyChecking=no -i '#{ssh_info[:private_key_path]}'",
hostpath,
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]