use '-o IdentityFile=' instead of '-i'

fixes ssh failure when path to the key contains '%'.
This commit is contained in:
Tomoyuki Sakurai 2016-10-04 17:21:11 +09:00 committed by Brian Cain
parent 4d30018665
commit 35f83b6fed
1 changed files with 5 additions and 1 deletions

View File

@ -135,7 +135,11 @@ module Vagrant
# If we're not in plain mode and :private_key_path is set attach the private key path(s). # If we're not in plain mode and :private_key_path is set attach the private key path(s).
if !plain_mode && options[:private_key_path] if !plain_mode && options[:private_key_path]
options[:private_key_path].each do |path| options[:private_key_path].each do |path|
command_options += ["-i", path.to_s]
# Use '-o' instead of '-i' because '-i' does not call
# percent_expand in misc.c, but '-o' does. when passing the path,
# replace '%' in the path with '%%' to escape the '%'
command_options += ["-o", "IdentityFile=%s" % [path.to_s.gsub('%', '%%')]]
end end
end end