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

New hosts os hosts file #18

Merged
merged 6 commits into from
Jun 19, 2013

Conversation

b2jrock
Copy link
Contributor

@b2jrock b2jrock commented Jun 13, 2013

(re-did this branch to make it easier to review)

This set of changes was made to manage hosts file entries on the host machine. This is so that you can use the hostnames to connect to your local boxes.

As part of this, I changed it so that we actually fetch the existing hosts file from the guest machines and add to it rather than overwriting.

Keywords added: hostmanager.manage_local = true
Manage local hosts file

Caveats:

Assumes that you need sudo to modify your local /etc/hosts file, I am planning on making this a configuration parameter in the near future.
It's assuming your hosts file is /etc/hosts, so it won't work with windows.

…ucture in place, rather than generating a local hosts entry automatically.
Conflicts:
	lib/vagrant-hostmanager/config.rb
	lib/vagrant-hostmanager/hosts_file.rb
	locales/en.yml
@smdahlen
Copy link
Contributor

@b2jrock Sorry, running behind. I'll look to review and merge tomorrow.

@smdahlen
Copy link
Contributor

@b2jrock After some testing, it appears that destroying a single machine within a multi-machine environment removed all entries in the hosts file on other guest machines. This does not occur on the host. I'm looking further now. If you have a fix, let me know, and I will re-pull from your branch.

@b2jrock
Copy link
Contributor Author

b2jrock commented Jun 17, 2013

That should remove only the single entry for that machine on the other
machines. I will attempt to reproduce that this morning.
On Jun 17, 2013 6:49 AM, "Shawn Dahlen" [email protected] wrote:

@b2jrock After some testing, it appears that destroying a single machine
within a multi-machine environment removed all entries in the hosts file on
other guest machines. This does not occur on the host. I'm looking further
now. If you have a fix, let me know, and I will re-pull from your branch.


Reply to this email directly or view it on GitHub.

@b2jrock
Copy link
Contributor Author

b2jrock commented Jun 17, 2013

Repro'd and found the bug, it seems that the machine id is coming through
as empty in certain cases, so the regex is matching everything when it goes
to delete.

Fix forthcoming.

Brian

On Mon, Jun 17, 2013 at 9:44 AM, Brian J [email protected] wrote:

That should remove only the single entry for that machine on the other
machines. I will attempt to reproduce that this morning.
On Jun 17, 2013 6:49 AM, "Shawn Dahlen" [email protected] wrote:

@b2jrock After some testing, it appears that destroying a single machine
within a multi-machine environment removed all entries in the hosts file on
other guest machines. This does not occur on the host. I'm looking further
now. If you have a fix, let me know, and I will re-pull from your branch.


Reply to this email directly or view it on GitHub.

- Set the hook for deletion to run prior to machine deletion so that the id is retrieveable.
@b2jrock
Copy link
Contributor Author

b2jrock commented Jun 18, 2013

Looking pretty good, I ran the following tests -- maybe we can document/automate this:

  • Create 3 machines with manage_local on
    -- Ensure that entries are added to local hosts file and hosts file on each guest, and that localhost entry is correct
  • Remove an entry from local hosts file, and one of the guests
    -- Run 'vagrant fhostmanager'
    -- ensure that the entry is recreated in both places.
  • run 'vagrant destroy machine' for any machine
    -- ensure that the machine entry is removed from all the machines and host machine
  • run 'vagrant destroy'
    -- ensure all machines are deleted from host hosts file

@smdahlen
Copy link
Contributor

I've pulled your update. I'll modify the acceptance test to automate the approach you outlined.

smdahlen added a commit that referenced this pull request Jun 19, 2013
This commit cleaned up the plugin's configuration and added code
comments for the hosts_file module. Additionally, display messages were
re-organized based on the single action.

The command still requires code to validate the configuration before
execution.

This closes pull request #18. Thanks to @b2jrock for his contribution.
@smdahlen smdahlen merged commit 2a190a2 into devopsgroup-io:master Jun 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants