Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Vagrant hosts updating plugin? #606

Closed
jeremyfelt opened this issue Apr 12, 2015 · 8 comments
Closed

Switch Vagrant hosts updating plugin? #606

jeremyfelt opened this issue Apr 12, 2015 · 8 comments

Comments

@jeremyfelt
Copy link
Member

vagrant-hostsupdater hasn't been updated in a while and may or may not be stable with current environments. See #603 as an example.

10up has a fork of vagrant-hostsupdater in Vagrant Ghost. @ericmann any thoughts on that being a stable replacement?

@zamoose Does HGV have any plans along these lines? I did a search and only ran into one related issue (HGV#40).

@jeremyfelt jeremyfelt added this to the 1.3.0 (Next Release) milestone Apr 12, 2015
@ericmann
Copy link
Contributor

I (obviously) have no objections here. For context, vagrant-hostsupdater was itself a fork of yet another unmaintained project (that broke when Vagrant changed the plugins API version a while back). We forked yet again so we could polish off some unimplemented features of the plugin.

Namely, command line usage.

In addition to setting the ghost.config.hosts array in a Vagrantfile, you can also update an aliases file in the project, then run vagrant ghost from the command line to automatically ingest those new host aliases into the machine (and your local hosts file). It's a simple change, but it was a command that worked in the original hostsmanager plugin, was abandoned in hostsupdater, and was required for our use.

I can definitely put together a PR for this change.

Note: @johnpbloch did the original forking work, but the plugin had to be co-located in another repo for testing. He lost props for his efforts when I migrated things into its own repository. I point this out to emphasize the project is supported by more than just me.

@EHLOVader
Copy link
Contributor

This seems interesting. How far from the original hostsupdater does the 10up fork get? and would it still be possible to add the commands to the host's sudoers file to skip the password each time?

I believe I have a script that works with the plugins now. https://gist.github.com/EHLOVader/606f7c9f8717608527b8

@ericmann
Copy link
Contributor

It cleans up a bit of the documentation, removes some dead code, and adds the ability to run vagrant ghost from the command-line to re-ingest your hosts and update the hosts file.

The "original" hostsupdater plugin was itself a fork of another plugin. The real original plugin wasn't updated to the v2 of the Vagrant plugin API, so it stopped working a while ago. Hostsupdater forked and updated some of the code, but skipped the CLI entirely (even though it reports as being available with vagrant list-commands).

The entire point of the Ghost fork is to keep the plugin alive (there's no guarantee that Vagrant will stick with the v2 plugins API) and to rebuild the CLI components of the plugin. Aside from that, we also switched to referring to an aliases file instead of a hosts file for a list of addresses. This is because we often use Ansible for provisioning, and a hosts file has a completely different meaning in that world (the recursive directory search of VVV flat out breaks things if used in an Ansible project).

@johnpbloch
Copy link
Contributor

On top of that, we also cleaned up how it behaves. The old plugin sometimes wouldn't add/remove hosts based on a variety of factors including what state the machine was transitioning into, or configuration options that prevented it from running on suspend by default. The new behavior is:

  1. If the machine is transitioning into a "not reachable" state (i.e. halt, suspend, destroy), remove the hosts.
  2. If it's transitioning into a "reachable" state (i.e. up, resume), add the hosts.
  3. If it's doing a reload, wait for boot then remove the hosts and re-add them.

Basically, if the vm isn't up and running, the hosts should not be in your host file.

@cfoellmann
Copy link
Member

the recursive directory search of VVV flat out breaks things if used in an Ansible project

@ericmann does this mean it will break auto setup sites?

@jeremyfelt jeremyfelt modified the milestones: Future Release, Next Release Jul 20, 2015
@cgsmith
Copy link

cgsmith commented Nov 3, 2015

Hey @jeremyfelt , I'll be releasing some fixes to vagrant-hostsupdater as I was added to the repo. I would love to include any contributions to help improve the project. I will also look at pulling in vagrant ghost changes into the repo.

morganestes added a commit to morganestes/VVV that referenced this issue Jan 22, 2016
Use the vagrant-ghost plugin to consolidate and manage hostfiles
instead of the current vagrant-hostsupdater. This doesn't take
advantage of the hosts collection that Ghost provides, since it only
looks for the `aliases` file for additional hostnames. Instead, it
keeps the existing hosts array generation, then passes that array
to the Ghost config for further management.

See Varying-Vagrant-Vagrants#606.
@jeremyfelt jeremyfelt modified the milestone: Future Release Aug 16, 2016
@jeremyfelt
Copy link
Member Author

I'm going to close this out. vagrant-hostsupdater is an active project at this point. Thanks for picking it up, @cgsmith! :)

@lock
Copy link

lock bot commented Feb 22, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants