mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
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:
commit
dc18b14880
@ -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
|
||||
|
@ -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}"]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user