Class: Vagrant::Command::SSHConfigCommand
- Defined in:
- lib/vagrant/command/ssh_config.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods included from Helpers
#initialize_environment, #target_vms
Constructor Details
This class inherits a constructor from Vagrant::Command::Base
Instance Method Details
#execute ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/vagrant/command/ssh_config.rb', line 7 def execute raise Errors::MultiVMTargetRequired, :command => "ssh_config" if target_vms.length > 1 vm = target_vms.first raise Errors::VMNotCreatedError if !vm.created? # We need to fix the file permissions of the key if they aren't set # properly, otherwise if the user attempts to SSH in, it won't work! vm.ssh.(vm.env.config.ssh.private_key_path) $stdout.puts(Util::TemplateRenderer.render("ssh_config", { :host_key => [:host] || "vagrant", :ssh_host => vm.env.config.ssh.host, :ssh_user => vm.env.config.ssh.username, :ssh_port => vm.ssh.port, :private_key_path => vm.env.config.ssh.private_key_path })) end |