Check verify_host_key for falsey or :never values when generating ssh config
This commit is contained in:
parent
7a7ae59704
commit
147b5c653e
|
@ -2,7 +2,7 @@ Host <%= host_key %>
|
||||||
HostName <%= ssh_host %>
|
HostName <%= ssh_host %>
|
||||||
User <%= ssh_user %>
|
User <%= ssh_user %>
|
||||||
Port <%= ssh_port %>
|
Port <%= ssh_port %>
|
||||||
<% if ! verify_host_key -%>
|
<% if ! verify_host_key || verify_host_key == :never -%>
|
||||||
UserKnownHostsFile /dev/null
|
UserKnownHostsFile /dev/null
|
||||||
StrictHostKeyChecking no
|
StrictHostKeyChecking no
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -151,5 +151,19 @@ Host #{machine.name}
|
||||||
subject.execute
|
subject.execute
|
||||||
expect(output).to include('IdentityFile /home/vagrant/home.key')
|
expect(output).to include('IdentityFile /home/vagrant/home.key')
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue