Method: Beaker::HostPrebuiltSteps#hack_etc_hosts
- Defined in:
- lib/beaker/host_prebuilt_steps.rb
#hack_etc_hosts(hosts, _opts) ⇒ Object
Update /etc/hosts to make it possible for each provided host to reach each other host by name. Assumes that each provided host has host set; in the instance where a provider sets host to an address which facilitates access to the host externally, but the actual host addresses differ from this, we check first for the presence of a host key first, and use that if present.
270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/beaker/host_prebuilt_steps.rb', line 270 def hack_etc_hosts hosts, _opts etc_hosts = "127.0.0.1\tlocalhost localhost.localdomain\n" hosts.each do |host| ip = host['vm_ip'] || host['ip'].to_s hostname = host[:vmhostname] || host.name domain = get_domain_name(host) etc_hosts += "#{ip}\t#{hostname}.#{domain} #{hostname}\n" end hosts.each do |host| set_etc_hosts(host, etc_hosts) end end |