agiledivider / vagrant-hostsupdater

MIT License
1.15k stars 129 forks source link

vagrant up & halt bring duplicate messages from hostsupdater #187

Closed fukasugi closed 3 years ago

fukasugi commented 3 years ago

As follows, when I conduct 'vagrant up' or 'vagrant halt', duplicated messages from this plugin appear and it makes multiple blank lines in hosts file in system32 (My OS is Windows10 Home).

λ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] Writing the following entries to (C:/WINDOWS/system32/drivers/etc/hosts) ==> default: [vagrant-hostsupdater] 192.168.33.15 magento.sale # VAGRANT: 04e4b92650a342d29d2e3ffb9f54dfe2 (default) / 0fcb9f1f-ec98-4264-b96e-f753919adfce ==> default: [vagrant-hostsupdater] This operation requires administrative access. You may skip it by manually adding equivalent entries to the hosts file. ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: Checking if box 'generic/debian10' version '2.0.6' is up to date... ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: Clearing any previously set forwarded ports... ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: Running 'pre-boot' VM customizations... ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key ==> default: Machine booted and ready! ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale [default] GuestAdditions 6.1.16 running --- OK. ==> default: Checking for guest additions in VM... ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: Setting hostname... ==> default: Configuring and enabling network interfaces... ==> default: Mounting shared folders... default: /vagrant_data => D:/Workspace/Development/Company/OneProof/ECMagento ==> default: Machine already provisioned. Run vagrant provision or use the --provision ==> default: flag to force provisioning. Provisioners marked to run always will still run. ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale ==> default: [vagrant-hostsupdater] Checking for host entries ==> default: [vagrant-hostsupdater] found entry for: 192.168.33.15 magento.sale

λ vagrant halt ==> default: [vagrant-hostsupdater] Removing hosts ==> default: [vagrant-hostsupdater] Removing hosts ==> default: Attempting graceful shutdown of VM... ==> default: [vagrant-hostsupdater] Removing hosts ==> default: [vagrant-hostsupdater] Removing hosts ==> default: [vagrant-hostsupdater] Removing hosts ==> default: [vagrant-hostsupdater] Removing hosts ==> default: [vagrant-hostsupdater] Removing hosts ==> default: [vagrant-hostsupdater] Removing hosts ==> default: [vagrant-hostsupdater] Removing hosts ==> default: [vagrant-hostsupdater] Removing hosts

I repeated installation and uninstallation during I examined vagrant, this might be the cause I'm not sure though? And assignment of IP to hostname is working properly, but these messages are ridiculoutly ugly. Help Me Please!

theodore86 commented 3 years ago

Indeed,

Appeared right after vagrant upgrade from 2.2.13 to 2.2.14 (observed at Windows 10)

geerlingguy commented 3 years ago

See: https://github.com/hashicorp/vagrant/issues/12070#issuecomment-732271918

Mte90 commented 3 years ago

This plugin is dead this is the reason why we started vagrant-goodhosts that is a fork of that, https://github.com/goodhosts/vagrant

We have the same issue, but I am trying to understand how to fix it.

geerlingguy commented 3 years ago

@Mte90 - I wouldn't quite call it dead... the latest commit is 2 days ago: https://github.com/agiledivider/vagrant-hostsupdater/commit/d35df1ba041a78b7b8e0147f2cf4f2e192887ca5

Some plugins, like this one, just kinda do the one thing they do, and do it well, and a lack of active development over a long period of time ≠ the project is dead or unmaintained. I have a number of projects where I'm happy with where they're at, I use them daily, and I might or might not get around to any kind of feature improvements, but I sure as heck will fix any major bugs :)

Mte90 commented 3 years ago

Well seems that after the last commit of february 2019 and the latest release of may 2018 there is a new version officially.

Well I have to project not active maintained but you have one with a lot of tickets and pr in queue since years, it is a fact that is dead also if works. Otherwise we will not fork it to create a new one that fix many issues on windows side and use an utility to manipulate the hosts file to avoid bugs.

Mte90 commented 3 years ago

To get back on track, as in Vagrant they are not helping on fixing this issue: https://github.com/hashicorp/vagrant/issues/12070#issuecomment-732271918

I tried various things to fix this issue without any success. The hook is appended in my tests in all the cases and the action get as parameter env but includes just the values when is added.

cgsmith commented 3 years ago

Lol! @Mte90 calling a plugin dead is a pretty strong accusation. If you have any PRs or issues that you would like merged in just let me know and I'll gladly accept them.

I'll be looking at this early next week to see if there is something that can be done to clean up the nuisance messages but it is not a priority for me to fix immediately. Things that are a high priority are fixed and pushed.

BR0kEN- commented 3 years ago

Here is the PR to resolve the issue https://github.com/agiledivider/vagrant-hostsupdater/pull/197.