Sha256: 2460ecf2df68225b5a8f9cb4c25c79fe31d1697f088bda85b4cfc5efd4da5422

Contents?: true

Size: 898 Bytes

Versions: 10

Compression:

Stored size: 898 Bytes

Contents

module Vagrant
  class Commands
    # Outputs a valid entry for .ssh/config which can be used to connect
    # to this environment.
    class SSHConfig < Base
      Base.subcommand "ssh-config", self
      description "outputs .ssh/config valid syntax for connecting to this environment via ssh"

      def execute(args=[])
        env.require_root_path

        parse_options(args)
        puts TemplateRenderer.render("ssh_config", {
          :host_key => options[:host] || "vagrant",
          :ssh_user => env.config.ssh.username,
          :ssh_port => env.ssh.port,
          :private_key_path => env.config.ssh.private_key_path
        })
      end

      def options_spec(opts)
        opts.banner = "Usage: vagrant ssh-config [--host NAME]"

        opts.on("-h", "--host [HOST]", "Host name for the SSH config") do |h|
          options[:host] = h
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
vagrantup-0.3.4 lib/vagrant/commands/ssh_config.rb
vagrantup-0.3.3 lib/vagrant/commands/ssh_config.rb
vagrantup-0.3.2 lib/vagrant/commands/ssh_config.rb
vagrantup-0.3.1 lib/vagrant/commands/ssh_config.rb
vagrantup-0.3.0 lib/vagrant/commands/ssh_config.rb
vagrant-0.3.4 lib/vagrant/commands/ssh_config.rb
vagrant-0.3.3 lib/vagrant/commands/ssh_config.rb
vagrant-0.3.2 lib/vagrant/commands/ssh_config.rb
vagrant-0.3.1 lib/vagrant/commands/ssh_config.rb
vagrant-0.3.0 lib/vagrant/commands/ssh_config.rb