Remove 'config' from ssh.defaults, and instead setup in '.connect'
This commit is contained in:
parent
50a569747c
commit
87e38a0bed
|
@ -376,7 +376,7 @@ module VagrantPlugins
|
||||||
# Build the options we'll use to initiate the connection via Net::SSH
|
# Build the options we'll use to initiate the connection via Net::SSH
|
||||||
common_connect_opts = {
|
common_connect_opts = {
|
||||||
auth_methods: auth_methods,
|
auth_methods: auth_methods,
|
||||||
config: ssh_info[:config],
|
config: false,
|
||||||
forward_agent: ssh_info[:forward_agent],
|
forward_agent: ssh_info[:forward_agent],
|
||||||
send_env: ssh_info[:forward_env],
|
send_env: ssh_info[:forward_env],
|
||||||
keys_only: ssh_info[:keys_only],
|
keys_only: ssh_info[:keys_only],
|
||||||
|
@ -414,6 +414,10 @@ module VagrantPlugins
|
||||||
connect_opts[:proxy] = Net::SSH::Proxy::Command.new(ssh_info[:proxy_command])
|
connect_opts[:proxy] = Net::SSH::Proxy::Command.new(ssh_info[:proxy_command])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ssh_info[:config]
|
||||||
|
connect_opts[:config] = ssh_info[:config]
|
||||||
|
end
|
||||||
|
|
||||||
@logger.info("Attempting to connect to SSH...")
|
@logger.info("Attempting to connect to SSH...")
|
||||||
@logger.info(" - Host: #{ssh_info[:host]}")
|
@logger.info(" - Host: #{ssh_info[:host]}")
|
||||||
@logger.info(" - Port: #{ssh_info[:port]}")
|
@logger.info(" - Port: #{ssh_info[:port]}")
|
||||||
|
|
|
@ -5,7 +5,6 @@ require_relative "ssh_connect"
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module Kernel_V2
|
module Kernel_V2
|
||||||
class SSHConfig < SSHConnectConfig
|
class SSHConfig < SSHConnectConfig
|
||||||
attr_accessor :config
|
|
||||||
attr_accessor :forward_agent
|
attr_accessor :forward_agent
|
||||||
attr_accessor :forward_x11
|
attr_accessor :forward_x11
|
||||||
attr_accessor :forward_env
|
attr_accessor :forward_env
|
||||||
|
@ -23,7 +22,6 @@ module VagrantPlugins
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
|
|
||||||
@config = UNSET_VALUE
|
|
||||||
@forward_agent = UNSET_VALUE
|
@forward_agent = UNSET_VALUE
|
||||||
@forward_x11 = UNSET_VALUE
|
@forward_x11 = UNSET_VALUE
|
||||||
@forward_env = UNSET_VALUE
|
@forward_env = UNSET_VALUE
|
||||||
|
@ -48,7 +46,6 @@ module VagrantPlugins
|
||||||
def finalize!
|
def finalize!
|
||||||
super
|
super
|
||||||
|
|
||||||
@config = false if @config == UNSET_VALUE
|
|
||||||
@forward_agent = false if @forward_agent == UNSET_VALUE
|
@forward_agent = false if @forward_agent == UNSET_VALUE
|
||||||
@forward_x11 = false if @forward_x11 == UNSET_VALUE
|
@forward_x11 = false if @forward_x11 == UNSET_VALUE
|
||||||
@forward_env = false if @forward_env == UNSET_VALUE
|
@forward_env = false if @forward_env == UNSET_VALUE
|
||||||
|
|
|
@ -748,6 +748,28 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||||
communicator.send(:connect)
|
communicator.send(:connect)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with config configured" do
|
||||||
|
|
||||||
|
before do
|
||||||
|
expect(machine).to receive(:ssh_info).and_return(
|
||||||
|
host: '127.0.0.1',
|
||||||
|
port: 2222,
|
||||||
|
config: './ssh_config',
|
||||||
|
keys_only: true,
|
||||||
|
verify_host_key: false
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "has password defined" do
|
||||||
|
expect(Net::SSH).to receive(:start).with(
|
||||||
|
anything, anything, hash_including(
|
||||||
|
config: './ssh_config'
|
||||||
|
)
|
||||||
|
).and_return(true)
|
||||||
|
communicator.send(:connect)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".generate_environment_export" do
|
describe ".generate_environment_export" do
|
||||||
|
|
|
@ -8,7 +8,6 @@ describe VagrantPlugins::Kernel_V2::SSHConfig do
|
||||||
describe "#default" do
|
describe "#default" do
|
||||||
it "defaults to vagrant username" do
|
it "defaults to vagrant username" do
|
||||||
subject.finalize!
|
subject.finalize!
|
||||||
expect(subject.default.config).to be_falsey
|
|
||||||
expect(subject.default.port).to eq(22)
|
expect(subject.default.port).to eq(22)
|
||||||
expect(subject.default.username).to eq("vagrant")
|
expect(subject.default.username).to eq("vagrant")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue