lib/vagrant-hosts/addresses.rb in vagrant-hosts-2.1.5 vs lib/vagrant-hosts/addresses.rb in vagrant-hosts-2.2.0
- old
+ new
@@ -1,13 +1,12 @@
module VagrantHosts::Addresses
private
def all_hosts(config)
-
all_hosts = []
- all_hosts += local_hosts(@machine)
+ all_hosts += local_hosts(@machine, config)
if config.autoconfigure
all_hosts += vagrant_hosts(@env)
end
all_hosts += config.hosts
@@ -28,14 +27,17 @@
hostnames << machine_name unless hostnames.include? machine_name
hostnames
end
- def local_hosts(machine)
- [
- ['127.0.0.1', ['localhost']],
- ['127.0.1.1', hostnames_for_machine(machine)],
- ]
+ def local_hosts(machine, config)
+ entries = [['127.0.0.1', ['localhost']]]
+
+ if config.add_localhost_hostnames
+ entries << ['127.0.1.1', hostnames_for_machine(machine)]
+ end
+
+ entries
end
def vagrant_hosts(env)
hosts = []