From c77326438b86a40bbc0d3ec93bbea7ec520392db Mon Sep 17 00:00:00 2001 From: guessi Date: Fri, 7 Oct 2016 19:40:36 +0800 Subject: [PATCH] Fix incorrect ssh-config output when '--host' is defined Fixes: #7728 Signed-off-by: guessi --- plugins/commands/ssh_config/command.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/commands/ssh_config/command.rb b/plugins/commands/ssh_config/command.rb index 7df07ff6e..7e8a5ce84 100644 --- a/plugins/commands/ssh_config/command.rb +++ b/plugins/commands/ssh_config/command.rb @@ -32,6 +32,10 @@ module VagrantPlugins ssh_info = machine.ssh_info raise Vagrant::Errors::SSHNotReady if ssh_info.nil? + if options[:host] && options[:host].to_s != machine.name.to_s + next + end + variables = { host_key: options[:host] || machine.name || "vagrant", ssh_host: ssh_info[:host],