From 87437317dc3bb474858814d33a9ce94c38113518 Mon Sep 17 00:00:00 2001 From: Gavin Williams Date: Thu, 27 Sep 2018 11:16:50 +0100 Subject: [PATCH] Add support for passing ssh config file in via config --- plugins/communicators/ssh/communicator.rb | 2 +- plugins/kernel_v2/config/ssh.rb | 3 +++ test/unit/plugins/kernel_v2/config/ssh_test.rb | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index e9b0cce8f..7f0b171dc 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -376,7 +376,7 @@ module VagrantPlugins # Build the options we'll use to initiate the connection via Net::SSH common_connect_opts = { auth_methods: auth_methods, - config: false, + config: ssh_info[:config], forward_agent: ssh_info[:forward_agent], send_env: ssh_info[:forward_env], keys_only: ssh_info[:keys_only], diff --git a/plugins/kernel_v2/config/ssh.rb b/plugins/kernel_v2/config/ssh.rb index 1dc3d51c9..07b362ed6 100644 --- a/plugins/kernel_v2/config/ssh.rb +++ b/plugins/kernel_v2/config/ssh.rb @@ -5,6 +5,7 @@ require_relative "ssh_connect" module VagrantPlugins module Kernel_V2 class SSHConfig < SSHConnectConfig + attr_accessor :config attr_accessor :forward_agent attr_accessor :forward_x11 attr_accessor :forward_env @@ -22,6 +23,7 @@ module VagrantPlugins def initialize super + @config = UNSET_VALUE @forward_agent = UNSET_VALUE @forward_x11 = UNSET_VALUE @forward_env = UNSET_VALUE @@ -46,6 +48,7 @@ module VagrantPlugins def finalize! super + @config = false if @config == UNSET_VALUE @forward_agent = false if @forward_agent == UNSET_VALUE @forward_x11 = false if @forward_x11 == UNSET_VALUE @forward_env = false if @forward_env == UNSET_VALUE diff --git a/test/unit/plugins/kernel_v2/config/ssh_test.rb b/test/unit/plugins/kernel_v2/config/ssh_test.rb index 15e23a7a0..ecb7a0831 100644 --- a/test/unit/plugins/kernel_v2/config/ssh_test.rb +++ b/test/unit/plugins/kernel_v2/config/ssh_test.rb @@ -8,6 +8,8 @@ describe VagrantPlugins::Kernel_V2::SSHConfig do describe "#default" do it "defaults to vagrant username" do subject.finalize! + expect(subject.default.config).to eq(false) + expect(subject.default.port).to eq(22) expect(subject.default.username).to eq("vagrant") end end