Check verify_host_key for falsey or :never values when generating ssh config

This commit is contained in:
Chris Roberts 2018-09-05 13:41:37 -07:00
parent 7a7ae59704
commit 147b5c653e
2 changed files with 15 additions and 1 deletions

View File

@ -2,7 +2,7 @@ Host <%= host_key %>
HostName <%= ssh_host %>
User <%= ssh_user %>
Port <%= ssh_port %>
<% if ! verify_host_key -%>
<% if ! verify_host_key || verify_host_key == :never -%>
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
<% end -%>

View File

@ -151,5 +151,19 @@ Host #{machine.name}
subject.execute
expect(output).to include('IdentityFile /home/vagrant/home.key')
end
it "handles verify_host_key :never value" do
allow(machine).to receive(:ssh_info) { ssh_info.merge(verify_host_key: :never) }
output = ""
allow(subject).to receive(:safe_puts) do |data|
output += data if data
end
subject.execute
expect(output).to include('StrictHostKeyChecking ')
expect(output).to include('UserKnownHostsFile ')
end
end
end