[DRE-commits] [vagrant-libvirt] 17/67: Proxy ssh through libvirt host, if libvirt is connected via ssh

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Apr 24 13:56:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to annotated tag 0.0.14
in repository vagrant-libvirt.

commit f0614b144db515acf499d67b1af67b16ff4ed357
Author: erik-smit <smite at zylon.net>
Date:   Tue Dec 3 19:55:05 2013 +0100

    Proxy ssh through libvirt host, if libvirt is connected via ssh
---
 lib/vagrant-libvirt/action/read_ssh_info.rb | 2 ++
 lib/vagrant-libvirt/action/sync_folders.rb  | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/vagrant-libvirt/action/read_ssh_info.rb b/lib/vagrant-libvirt/action/read_ssh_info.rb
index 1b90b24..6d324bc 100644
--- a/lib/vagrant-libvirt/action/read_ssh_info.rb
+++ b/lib/vagrant-libvirt/action/read_ssh_info.rb
@@ -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
diff --git a/lib/vagrant-libvirt/action/sync_folders.rb b/lib/vagrant-libvirt/action/sync_folders.rb
index df8a2f9..edd9908 100644
--- a/lib/vagrant-libvirt/action/sync_folders.rb
+++ b/lib/vagrant-libvirt/action/sync_folders.rb
@@ -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}"]
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/vagrant-libvirt.git



More information about the Pkg-ruby-extras-commits mailing list