Fix parsing SSH extra args in multi-machine envs [GH-1545]

This commit is contained in:
Mitchell Hashimoto 2013-04-07 22:07:55 -07:00
parent 7fa9892b75
commit 8b2bf72e8a
2 changed files with 10 additions and 12 deletions

View File

@ -65,6 +65,8 @@ BUG FIXES:
merged for the proper before/after chain. [GH-1555]
- Use the Vagrant temporary directory again for temporary files
since they can be quite large and were messing with tmpfs. [GH-1442]
- Fix issue parsing extra SSH args in `vagrant ssh` in multi-machine
environments. [GH-1545]
## 1.1.6 (April 3, 2013)

View File

@ -19,22 +19,18 @@ module VagrantPlugins
end
end
# Parse out the extra args to send to SSH, which is everything
# after the "--"
split_index = @argv.index("--")
if split_index
options[:ssh_args] = @argv.drop(split_index + 1)
@argv = @argv.take(split_index)
end
# Parse the options and return if we don't have any target.
argv = parse_options(opts)
return if !argv
# Parse out the extra args to send to SSH, which is everything
# after the "--"
ssh_args = ARGV.drop_while { |i| i != "--" }
ssh_args = ssh_args[1..-1]
options[:ssh_args] = ssh_args
# If the remaining arguments ARE the SSH arguments, then just
# clear it out. This happens because optparse returns what is
# after the "--" as remaining ARGV, and Vagrant can think it is
# a multi-vm name (wrong!)
argv = [] if argv == ssh_args
# Execute the actual SSH
with_target_vms(argv, :single_target => true) do |vm|
if options[:command]