Merge pull request #6714 from mitchellh/sethvargo/shell_env_to_s

Convert env values to strings before escaping
This commit is contained in:
Mitchell Hashimoto 2015-12-22 13:30:18 -08:00
commit 9092779026
1 changed files with 4 additions and 2 deletions

View File

@ -47,7 +47,8 @@ module VagrantPlugins
# This is the provision method called if SSH is what is running # This is the provision method called if SSH is what is running
# on the remote end, which assumes a POSIX-style host. # on the remote end, which assumes a POSIX-style host.
def provision_ssh(args) def provision_ssh(args)
env = config.env.map { |k,v| "#{k}=#{quote_and_escape(v)}" }.join(" ") env = config.env.map { |k,v| "#{k}=#{quote_and_escape(v.to_s)}" }
env = env.join(" ")
command = "chmod +x '#{config.upload_path}'" command = "chmod +x '#{config.upload_path}'"
command << " &&" command << " &&"
@ -113,7 +114,8 @@ module VagrantPlugins
comm.upload(path.to_s, upload_path) comm.upload(path.to_s, upload_path)
# Build the environment # Build the environment
env = config.env.map { |k,v| "$env:#{k} = #{quote_and_escape(v)}" }.join("; ") env = config.env.map { |k,v| "$env:#{k} = #{quote_and_escape(v.to_s)}" }
env = env.join("; ")
# Calculate the path that we'll be executing # Calculate the path that we'll be executing
exec_path = upload_path exec_path = upload_path