fix for ssh keys from(copied from vagrant-aws)

This commit is contained in:
dima 2013-12-17 08:20:19 +01:00
parent 6e3a9fe411
commit f9f83749f4

View File

@ -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