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

Added skip feature #62

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,26 @@ This plugin adds an entry to your /etc/hosts file on the host system.
On **up**, **resume** and **reload** commands, it tries to add the information, if its not already existant in your hosts file. If it needs to be added, you will be asked for an administrator password, since it uses sudo to edit the file.

On **halt** and **destroy**, those entries will be removed again.
By setting the remove\_on\_suspend option, you can have them removed on **suspend**, too:

## Remove on suspend

By setting the `remove_on_suspend` option, you can have them removed on **suspend**, too:

config.hostsupdater.remove_on_suspend = true

## Skipping hostupdater

To skip adding some entries to the /etc/hosts file add `hostsupdater: "skip"` option to network configuration:

config.vm.network :private_network, ip: "172.21.9.9", hostsupdater: "skip"

Example:

config.vm.network :private_network, ip: "192.168.50.4"
config.vm.network :private_network,
ip: "172.21.9.9",
netmask: "255.255.240.0",
hostsupdater: "skip"

## Installation

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-hostsupdater/HostsUpdater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def getIps
ips = []
@machine.config.vm.networks.each do |network|
key, options = network[0], network[1]
ip = options[:ip] if key == :private_network
ip = options[:ip] if key == :private_network && options[:hostsupdater] != "skip"
ips.push(ip) if ip
end
return ips
Expand Down