Sha256: 75948053d70cb049fd19a9b237bb3c5a42f5cb3ed63b29cfac9b552048f6096b

Contents?: true

Size: 951 Bytes

Versions: 3

Compression:

Stored size: 951 Bytes

Contents

module VagrantPlugins
  module Exec
    module SSHHelper

      SSH_CONFIG = '.vagrant/ssh_config'.freeze

      private

      # @todo Pretty much copy-paste of vagrant 'plugins/commands/ssh_config'
      def save_ssh_config(host, ssh_info)
        raise Vagrant::Errors::SSHNotReady if ssh_info.nil?

        variables = {
          host_key: host || 'vagrant',
          ssh_host: ssh_info[:host],
          ssh_port: ssh_info[:port],
          ssh_user: ssh_info[:username],
          private_key_path: ssh_info[:private_key_path],
          forward_agent: ssh_info[:forward_agent],
          forward_x11: ssh_info[:forward_x11],
          proxy_command: ssh_info[:proxy_command]
        }

        template = 'commands/ssh_config/config'
        config = Vagrant::Util::TemplateRenderer.render(template, variables)

        File.open(SSH_CONFIG, 'w') { |file| file.write(config) }
      end

    end # SSHHelper
  end # Exec
end # VagrantPlugins

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-exec-0.5.3 lib/vagrant-exec/support/ssh_helper.rb
vagrant-exec-0.5.2 lib/vagrant-exec/support/ssh_helper.rb
vagrant-exec-0.5.1 lib/vagrant-exec/support/ssh_helper.rb