vagrant-landrush / landrush

A Vagrant plugin that provides a simple DNS server for Vagrant guests
MIT License
666 stars 78 forks source link

Problems defining an empty tld in Mac OS X #308

Open dortegau opened 7 years ago

dortegau commented 7 years ago

I have problems when I define an empty TLD using landrush & molecule:

/Users/dortega/.vagrant.d/gems/gems/landrush-1.2.0/lib/landrush/cap/host/darwin/configure_visibility_on_host.rb:46:in `read': Is a directory @ io_fread - /etc/resolver (Errno::EISDIR)
    from /Users/dortega/.vagrant.d/gems/gems/landrush-1.2.0/lib/landrush/cap/host/darwin/configure_visibility_on_host.rb:46:in `contents_match?'
    from /Users/dortega/.vagrant.d/gems/gems/landrush-1.2.0/lib/landrush/cap/host/darwin/configure_visibility_on_host.rb:11:in `configure_visibility_on_host'

Mac OS X version: 10.12.3 Vagrant version: 1.8.6 (same problems using 1.9.2 version) landrush version: 1.2.0

I think that the problem resides in this method definition: https://github.com/vagrant-landrush/landrush/blob/master/lib/landrush/cap/host/darwin/configure_visibility_on_host.rb#L41 because the config_dir is joined with the tld and the tld is empty in my configuration (defined in molecule.yml config):

vagrant:
  raw_config_args:
    - "landrush.enabled = true"
    - "landrush.tld = ''"
    - "landrush.guest_redirect_dns = false"
hferentschik commented 5 years ago

Why would you like to set an empty TLD?

dortegau commented 5 years ago

I don’t use TLDs in Linux because I don’t need them, but it doesn’t work in Mac OS X.

I always use hostnames as simple as possible like “service1” or similar.

hferentschik commented 5 years ago

The way the '/etc/resolver' system works on macOS requires that you define a TLD. Hence also the default of 'vagrant.test'. Not sure how host visibility would work then on macOS. Do you have any suggestions?

One could fail already fail earlier when validating the config and provide a better error message. However, that would of course still not give you an empty TLD.