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
2 changed files with 4 additions and 1 deletions

View File

@@ -48,6 +48,8 @@ module VagrantPlugins
: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
end

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}"]