lib/vagrant-hosts/cap/sync_hosts/base.rb in vagrant-hosts-2.7.1 vs lib/vagrant-hosts/cap/sync_hosts/base.rb in vagrant-hosts-2.8.0
- old
+ new
@@ -12,9 +12,15 @@
@machine, @config = machine, config
@env = @machine.env
end
def sync!
+ # This ensures that a default hostname is created from the macine name
+ # if the VM wasn't configured with a hostname.
+ #
+ # FIXME: Write tests for this behavior.
+ # TODO: Move this behavior into a config block on the hosts provisioner
+ # so that this capability can remain focused on updating /etc/hosts.
hostname = @machine.config.vm.hostname || @machine.name.to_s
change_host_name(hostname)
# call to method not implemented by abstract base class
update_hosts