Added new include_offline configuration item
This commit is contained in:
parent
6e4a2ae967
commit
0b3e60cb5d
|
@ -40,6 +40,10 @@ to true.
|
|||
A machine's host name is defined by `config.vm.hostname`. If this is not
|
||||
set, it falls back to the symbol defining the machine in the Vagrantfile.
|
||||
|
||||
When using include_offline set to true, only boxes that are up or have a
|
||||
private ip configured will be added to the hosts file. You will receive a
|
||||
warning on skipped boxes.
|
||||
|
||||
In addition, the `hostmanager.aliases` configuration attribute can be used
|
||||
to provide aliases for your host names.
|
||||
|
||||
|
@ -49,6 +53,7 @@ Example configuration:
|
|||
Vagrant.configure("2") do |config|
|
||||
config.hostmanager.enabled = true
|
||||
config.hostmanager.ignore_private_ip = false
|
||||
config.hostmanager.include_offline = true
|
||||
config.vm.define "example-box" do |node|
|
||||
node.vm.hostname = "example-box-hostname"
|
||||
node.vm.network :private_network, ip: "192.168.42.42"
|
||||
|
|
|
@ -4,13 +4,16 @@ module VagrantPlugins
|
|||
attr_accessor :enabled
|
||||
attr_accessor :ignore_private_ip
|
||||
attr_accessor :aliases
|
||||
attr_accessor :include_offline
|
||||
|
||||
alias_method :enabled?, :enabled
|
||||
alias_method :include_offline?, :include_offline
|
||||
|
||||
def initialize
|
||||
@enabled = false
|
||||
@ignore_private_ip = UNSET_VALUE
|
||||
@aliases = Array.new
|
||||
@include_offline = false
|
||||
end
|
||||
|
||||
def finalize!
|
||||
|
@ -24,6 +27,9 @@ module VagrantPlugins
|
|||
# check if enabled option is either true or false
|
||||
errors << validate_bool('hostmanager.enabled', enabled)
|
||||
|
||||
# check if include_offline is either true or false
|
||||
errors << validate_bool('hostmanager.include_offline', include_offline)
|
||||
|
||||
# check if ignore_private_ip option is either true or false (or UNSET_VALUE)
|
||||
if @ignore_private_ip != UNSET_VALUE
|
||||
errors << validate_bool('hostmanager.ignore_private_ip', ignore_private_ip)
|
||||
|
|
Loading…
Reference in New Issue