You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running Hyper-V and Laravel Homestead. The IP address configured in Homestead.yaml is being used to update the hosts file instead of the IP reported by the box being started. Honestly, not 100% sure if this is on your end or their's.
Vagrantfile from homestead:
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))
homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
customizationScriptPath = confDir + "/user-customizations.sh"
aliasesPath = confDir + "/aliases"
require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')
Vagrant.require_version '>= 2.2.4'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exist? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
config.vm.provision "shell" do |s|
s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
end
end
if File.exist? homesteadYamlPath then
settings = YAML::load(File.read(homesteadYamlPath))
elsif File.exist? homesteadJsonPath then
settings = JSON::parse(File.read(homesteadJsonPath))
else
abort "Homestead settings file not found in #{confDir}"
end
Homestead.configure(config, settings)
if File.exist? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
end
if File.exist? customizationScriptPath then
config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
end
if Vagrant.has_plugin?('vagrant-hostsupdater')
config.hostsupdater.remove_on_suspend = false
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
elsif Vagrant.has_plugin?('vagrant-hostmanager')
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
end
if Vagrant.has_plugin?('vagrant-notify-forwarder')
config.notify_forwarder.enable = true
end
end
And that settings var gets pulled from a yaml file, like this one:
I do have a similar issue when using hyper-v. In my case, the IP reported by the started VM is not used either. Because the private-network is configured with ip: nil, no hosts entries are created at all. I can 'fix' this by manually setting the IP in the Vagrantfile, but this will obviously only work as long as the VM gets assigned the same IP (which seems to be the case so far judging after several reboots).
config.vm.provider :hyperv do |_v, override|
override.vm.network :private_network, id: 'vvv_primary', ip: nil
end
I'm running Hyper-V and Laravel Homestead. The IP address configured in Homestead.yaml is being used to update the hosts file instead of the IP reported by the box being started. Honestly, not 100% sure if this is on your end or their's.
Vagrantfile from homestead:
And that settings var gets pulled from a yaml file, like this one:
You can see an IP is declared at the top of that, but I don't see where that's being translated to this plugin in any way.
The text was updated successfully, but these errors were encountered: