-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
This is the current version of the 'add_host' method, called by Vagrantfiles:
https://github.com/oscar-stack/vagrant-hosts/blob/master/lib/vagrant-hosts/config.rb#L63-L69
There is no checking of the supplied arguments (see #80). If 'address' is nil, an invalid entry is stored within the '@hosts' list, causing the hosts provisioner to fail later with:
/home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/addresses.rb:186:in `resolve_addresses': undefined method `start_with?' for nil:NilClass (NoMethodError)
from /home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/addresses.rb:137:in `block in resolve_host_entries'
from /home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/addresses.rb:135:in `each'
from /home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/addresses.rb:135:in `flat_map'
from /home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/addresses.rb:135:in `resolve_host_entries'
from /home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/addresses.rb:34:in `all_hosts'
from /home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/cap/sync_hosts/posix.rb:34:in `format_hosts'
from /home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/cap/sync_hosts/posix.rb:11:in `update_hosts'
from /home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/cap/sync_hosts/base.rb:31:in `sync!'
from /home/USER/.vagrant.d/gems/2.4.4/gems/vagrant-hosts-2.9.0/lib/vagrant-hosts/cap/sync_hosts/base.rb:11:in `sync_hosts'
from /opt/vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/capability_host.rb:111:in `call'
...
This is not the expected behavior, and it's hard to diagnose. I would expect the error to be raised when calling the add_host method, to get a reasonable stack trace, or even a message in vagrant validate
Metadata
Metadata
Assignees
Labels
No labels