From db11c16b79707a393d3cb26a0ff57c404b808b72 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 13 Aug 2012 19:48:26 -0700 Subject: [PATCH] ssh_config works with new machine abstraction --- plugins/commands/ssh_config/command.rb | 20 +++++++++----------- templates/locales/en.yml | 6 ++++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/plugins/commands/ssh_config/command.rb b/plugins/commands/ssh_config/command.rb index 7ca855ea5..e9ce9e78a 100644 --- a/plugins/commands/ssh_config/command.rb +++ b/plugins/commands/ssh_config/command.rb @@ -10,12 +10,11 @@ module VagrantPlugins def execute options = {} - opts = OptionParser.new do |opts| - opts.banner = "Usage: vagrant ssh-config [vm-name] [-h name]" + opts = OptionParser.new do |o| + o.banner = "Usage: vagrant ssh-config [vm-name] [-h name]" + o.separator "" - opts.separator "" - - opts.on("--host COMMAND", "Name the host for the config..") do |h| + o.on("--host COMMAND", "Name the host for the config..") do |h| options[:host] = h end end @@ -23,13 +22,12 @@ module VagrantPlugins argv = parse_options(opts) return if !argv - with_target_vms(argv, :single_target => true) do |vm| - raise Vagrant::Errors::VMNotCreatedError if !vm.created? - raise Vagrant::Errors::VMInaccessible if !vm.state == :inaccessible + with_target_vms(argv, :single_target => true) do |machine| + ssh_info = machine.ssh_info + raise Vagrant::Errors::SSHNotReady if ssh_info.nil? - ssh_info = vm.ssh.info variables = { - :host_key => options[:host] || vm.name || "vagrant", + :host_key => options[:host] || machine.name || "vagrant", :ssh_host => ssh_info[:host], :ssh_port => ssh_info[:port], :ssh_user => ssh_info[:username], @@ -45,7 +43,7 @@ module VagrantPlugins # Success, exit status 0 0 - end + end end end end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 36c17aa3c..30f3d4513 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -164,8 +164,10 @@ en: The provider for this Vagrant-managed machine is reporting that it is not yet ready for SSH. Depending on your provider this can carry different meanings. Make sure your machine is created and running and - try again. If you continue to get this error message, please view the - documentation for the provider you're using. + try again. Additionally, check the output of `vagrant status` to verify + that the machine is in the state that you expect. If you continue to + get this error message, please view the documentation for the provider + you're using. ssh_port_not_detected: |- Vagrant couldn't determine the SSH port for your VM! Vagrant attempts to automatically find a forwarded port that matches your `config.ssh.guest_port`