provisioners/ansible: spare machine.ssh_info calls
As a result of #4670 and the safe decision to not memoize machine.ssh_info (see89a4a29d65
and5036d16461
), it is preferable to store the ssh_info hashes and avoid multiple function calls when generating the ansible inventory.
This commit is contained in:
parent
5829c27048
commit
1e324093a5
|
@ -108,8 +108,9 @@ module VagrantPlugins
|
||||||
@machine.env.active_machines.each do |am|
|
@machine.env.active_machines.each do |am|
|
||||||
begin
|
begin
|
||||||
m = @machine.env.machine(*am)
|
m = @machine.env.machine(*am)
|
||||||
if !m.ssh_info.nil?
|
m_ssh_info = m.ssh_info
|
||||||
file.write("#{m.name} ansible_ssh_host=#{m.ssh_info[:host]} ansible_ssh_port=#{m.ssh_info[:port]}\n")
|
if !m_ssh_info.nil?
|
||||||
|
file.write("#{m.name} ansible_ssh_host=#{m_ssh_info[:host]} ansible_ssh_port=#{m_ssh_info[:port]}\n")
|
||||||
inventory_machines[m.name] = m
|
inventory_machines[m.name] = m
|
||||||
else
|
else
|
||||||
@logger.error("Auto-generated inventory: Impossible to get SSH information for machine '#{m.name} (#{m.provider_name})'. This machine should be recreated.")
|
@logger.error("Auto-generated inventory: Impossible to get SSH information for machine '#{m.name} (#{m.provider_name})'. This machine should be recreated.")
|
||||||
|
|
Loading…
Reference in New Issue