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

Prevent wiping of addresses of other providers #169

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7c06c81
Fix for issue #108, add a flag to manage guest hosts file.
Nov 14, 2014
ef2f01c
Improve README.md for Passwordless sudo.
tjanez Oct 13, 2015
270c15d
Prevent wiping of addresses of other providers
Nov 6, 2015
7715a76
Updating Contribute section to be specific.
seth-reeser Dec 30, 2015
117dc4b
v1.7.0 release.
seth-reeser Dec 30, 2015
c92cff0
Update README.md
seth-reeser Jan 15, 2016
dcd0351
Merge pull request #167 from tjanez/readme-passwordless-sudo
seth-reeser Jan 20, 2016
11677f2
Update README.md
seth-reeser Jan 27, 2016
dd43278
Ensure permissions on /etc/hosts stay intact
Jan 29, 2016
d1ba474
Merge pull request #176 from criticalstack/fix-selinux-permissions-on…
seth-reeser Jan 29, 2016
f1b0174
Releasing v1.7.1
seth-reeser Jan 29, 2016
3b840be
Merge pull request #125 from damienjoldersma/feature/manage-guest-flag
seth-reeser Feb 11, 2016
6f4c0d7
Releasing v1.8.0
seth-reeser Feb 11, 2016
a179758
Fixes #177 - Manage the guest by default.
seth-reeser Feb 11, 2016
ab8b041
Prevent wiping of addresses of other providers
Nov 6, 2015
2b5e0ae
Merge branch 'master' of github.com:lomignet/vagrant-hostmanager
Feb 19, 2016
494a3e3
Merge pull request #117 from pbitty/separate_aliases_option
seth-reeser Jul 22, 2015
13d95ba
Add option add_current_fqdn
Feb 19, 2016
9b7f385
refactor to have machine list in its own method
Feb 19, 2016
abac3e8
handle short name and removing from 127.*
Feb 19, 2016
43a88f8
remove old debug statement
Feb 19, 2016
aa39351
Prepare vagrant-hostoverseer release
Feb 22, 2016
b30f835
prepare public release
Feb 22, 2016
2a54f78
Add git url in gemspec
Feb 22, 2016
ae39240
Learning how to publish ruby gems...
Feb 22, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add option add_current_fqdn
  • Loading branch information
Guillaume committed Feb 19, 2016
commit 13d95bac8d63f20f00e47ba2d82a855f4621d59c
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ for some providers. Version 1.2 reverts this feature until a suitable implementa
supporting all providers is available.

***Potentially breaking change in v1.5.0:*** the running order on `vagrant up` has changed
so that hostmanager runs before provisioning takes place. This ensures all hostnames are
available to the guest when it is being provisioned
so that hostmanager runs before provisioning takes place. This ensures all hostnames are
available to the guest when it is being provisioned
(see [#73](https://github.com/smdahlen/vagrant-hostmanager/issues/73)).
Previously, hostmanager would run as the very last action. If you depend on the old behavior,
Previously, hostmanager would run as the very last action. If you depend on the old behavior,
see the [provisioner](#provisioner) section.

Installation
Expand Down Expand Up @@ -68,6 +68,12 @@ On some systems, long alias lines have been reported to cause issues
In such cases, you may render aliases on separate lines by setting
```hostmanager.aliases_on_separate_lines = true```.

If you have all your aliases on one line and you do not manage the fqdn fully
from vagrant (AWS for instance) you might want to add the fqdn as
well on this line to have only one canonical line. In such case, set
```hostmanager.add_current_fqdn = true```.


Example configuration:

```ruby
Expand All @@ -87,9 +93,9 @@ end

### Provisioner

Starting at version 1.5.0, `vagrant up` runs hostmanager before any provisioning occurs.
If you would like hostmanager to run after or during your provisioning stage,
you can use hostmanager as a provisioner. This allows you to use the provisioning
Starting at version 1.5.0, `vagrant up` runs hostmanager before any provisioning occurs.
If you would like hostmanager to run after or during your provisioning stage,
you can use hostmanager as a provisioner. This allows you to use the provisioning
order to ensure that hostmanager runs when desired. The provisioner will collect
hosts from boxes with the same provider as the running box.

Expand Down
4 changes: 3 additions & 1 deletion lib/vagrant-hostmanager/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Config < Vagrant.plugin('2', :config)
attr_accessor :include_offline
attr_accessor :ip_resolver
attr_accessor :aliases_on_separate_lines
attr_accessor :add_current_fqdn

alias_method :enabled?, :enabled
alias_method :include_offline?, :include_offline
Expand All @@ -24,6 +25,7 @@ def initialize
@aliases = UNSET_VALUE
@ip_resolver = UNSET_VALUE
@aliases_on_separate_lines = UNSET_VALUE
@add_current_fqdn = UNSET_VALUE
end

def finalize!
Expand All @@ -35,7 +37,7 @@ def finalize!
@aliases = [] if @aliases == UNSET_VALUE
@ip_resolver = nil if @ip_resolver == UNSET_VALUE
@aliases_on_separate_lines = false if @aliases_on_separate_lines == UNSET_VALUE

@add_current_fqdn = false if @add_current_fqdn == UNSET_VALUE
@aliases = [ @aliases ].flatten
end

Expand Down
32 changes: 25 additions & 7 deletions lib/vagrant-hostmanager/hosts_file/updater.rb
Original file line number Diff line number Diff line change