diff --git a/CHANGELOG.md b/CHANGELOG.md index 659a246b0..365598018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/plugins/commands/ssh/command.rb b/plugins/commands/ssh/command.rb index a062f81fe..8b3222ee5 100644 --- a/plugins/commands/ssh/command.rb +++ b/plugins/commands/ssh/command.rb @@ -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]