Sha256: 10599e8a479445f757e92f0edf8db40f2d206444debc462428ccf43d26b937f5

Contents?: true

Size: 794 Bytes

Versions: 4

Compression:

Stored size: 794 Bytes

Contents

module Vagrant
  module Command
    class SSHConfigCommand < NamedBase
      class_option :host, :type => :string, :default => nil, :aliases => "-h"
      register "ssh_config", "outputs .ssh/config valid syntax for connecting to this environment via ssh"

      def execute
        raise Errors::MultiVMTargetRequired.new(:command => "ssh_config") if target_vms.length > 1
        vm = target_vms.first
        raise Errors::VMNotCreatedError.new if !vm.created?

        env.ui.info(Util::TemplateRenderer.render("ssh_config", {
          :host_key => options[:host] || "vagrant",
          :ssh_user => vm.env.config.ssh.username,
          :ssh_port => vm.ssh.port,
          :private_key_path => vm.env.config.ssh.private_key_path
        }), :prefix => false)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vagrantup-0.6.5 lib/vagrant/command/ssh_config.rb
vagrantup-0.6.4 lib/vagrant/command/ssh_config.rb
vagrant-0.6.5 lib/vagrant/command/ssh_config.rb
vagrant-0.6.4 lib/vagrant/command/ssh_config.rb