From f9f83749f4434d7555dceaed685e8458327c1773 Mon Sep 17 00:00:00 2001 From: dima Date: Tue, 17 Dec 2013 08:20:19 +0100 Subject: [PATCH] fix for ssh keys from(copied from vagrant-aws) --- lib/vagrant-libvirt/action/sync_folders.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/vagrant-libvirt/action/sync_folders.rb b/lib/vagrant-libvirt/action/sync_folders.rb index edd9908..0ba0c60 100644 --- a/lib/vagrant-libvirt/action/sync_folders.rb +++ b/lib/vagrant-libvirt/action/sync_folders.rb @@ -27,7 +27,7 @@ module VagrantPlugins # avoid creating an additional directory with rsync hostpath = "#{hostpath}/" if hostpath !~ /\/$/ - env[:ui].info(I18n.t("vagrant_libvirt.rsync_folder", + env[:ui].info(I18n.t('vagrant_libvirt.rsync_folder', :hostpath => hostpath, :guestpath => guestpath)) @@ -38,9 +38,9 @@ module VagrantPlugins # Rsync over to the guest path using the SSH info command = [ - "rsync", "--del", "--verbose", "--archive", "-z", - "--exclude", ".vagrant/", - "-e", "ssh -p #{ssh_info[:port]} #{proxycommand} -o StrictHostKeyChecking=no -i '#{ssh_info[:private_key_path]}'", + 'rsync', '--del', '--verbose', '--archive', '-z', + '--exclude', '.vagrant/', + '-e', "ssh -p #{ssh_info[:port]} #{proxycommand} -o StrictHostKeyChecking=no #{ssh_key_options(ssh_info)}", hostpath, "#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"] @@ -53,6 +53,12 @@ module VagrantPlugins end end end + private + + def ssh_key_options(ssh_info) + # Ensure that `private_key_path` is an Array (for Vagrant < 1.4) + Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}' " }.join + end end end end