mirror of
https://github.com/puppetlabs/beaker-vmpooler.git
synced 2026-01-26 11:08:40 -05:00
(BKR-1155) Add a Prefered SSH Connection Method
BKR-834 made vmhostname the default lookup method for SSH connections but this broke hypervisors which don't have DNS support e.g. OpenStack. By setting the connection method in the hypervisor we can choose where to prefer specific methods.
This commit is contained in:
parent
ee4bbc32bd
commit
8af04e5aa7
2 changed files with 30 additions and 1 deletions
|
|
@ -243,6 +243,10 @@ module Beaker
|
||||||
@logger.debug "No disks to add for #{hostname}"
|
@logger.debug "No disks to add for #{hostname}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Override SSH connection method if not already explicitly configured.
|
||||||
|
# IP addresses can change across reboots with vmpooler so prefer DNS based resolution
|
||||||
|
@hosts.each {|h| h[:connection_method] ||= 'vmhostname'}
|
||||||
end
|
end
|
||||||
|
|
||||||
def cleanup
|
def cleanup
|
||||||
|
|
@ -352,4 +356,4 @@ module Beaker
|
||||||
disk_added?(parsed[hostname], disk_size, index)
|
disk_added?(parsed[hostname], disk_size, index)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,31 @@ module Beaker
|
||||||
/Vmpooler\.provision - requested VM templates \[[^\,]*\] not available/
|
/Vmpooler\.provision - requested VM templates \[[^\,]*\] not available/
|
||||||
) # should be only one item in the list, no commas
|
) # should be only one item in the list, no commas
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'ignores the ssh connection type when explicitly configured' do
|
||||||
|
hosts = make_hosts
|
||||||
|
hosts.each {|h| h[:connection_method] = 'explicit_connection_type'}
|
||||||
|
|
||||||
|
vmpooler = Beaker::Vmpooler.new( hosts, make_opts )
|
||||||
|
vmpooler.provision
|
||||||
|
|
||||||
|
hosts = vmpooler.instance_variable_get( :@hosts )
|
||||||
|
hosts.each do | host |
|
||||||
|
expect(host[:connection_method]).to be === 'explicit_connection_type'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets the ssh connection type to vmhostname when not explicitly configured' do
|
||||||
|
#p make_hosts
|
||||||
|
vmpooler = Beaker::Vmpooler.new( make_hosts, make_opts )
|
||||||
|
vmpooler.provision
|
||||||
|
|
||||||
|
hosts = vmpooler.instance_variable_get( :@hosts )
|
||||||
|
hosts.each do | host |
|
||||||
|
# p host
|
||||||
|
expect(host[:connection_method]).to be === 'vmhostname'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#cleanup" do
|
describe "#cleanup" do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue