allow all config variables to be set at top-level and overridden per-machine

All config variables now get initialized to UNSET_VALUE so that any per-machine variables that are unspecified can fall-through to a higher-level config when the config hierarchy is merged by vagrant.

Fixes #91.
This commit is contained in:
Paulo Bittencourt 2014-05-26 13:57:11 -04:00
parent 378cfda03c
commit f113535fe8
1 changed files with 13 additions and 9 deletions

View File

@ -13,18 +13,22 @@ module VagrantPlugins
alias_method :manage_host?, :manage_host
def initialize
@enabled = false
@manage_host = UNSET_VALUE
@ignore_private_ip = UNSET_VALUE
@include_offline = UNSET_VALUE
@aliases = []
@ip_resolver = nil
@enabled = UNSET_VALUE
@manage_host = UNSET_VALUE
@ignore_private_ip = UNSET_VALUE
@include_offline = UNSET_VALUE
@aliases = UNSET_VALUE
@ip_resolver = UNSET_VALUE
end
def finalize!
@manage_host = false if @manage_host == UNSET_VALUE
@ignore_private_ip = false if @ignore_private_ip == UNSET_VALUE
@include_offline = false if @include_offline == UNSET_VALUE
@enabled = false if @enabled == UNSET_VALUE
@manage_host = false if @manage_host == UNSET_VALUE
@ignore_private_ip = false if @ignore_private_ip == UNSET_VALUE
@include_offline = false if @include_offline == UNSET_VALUE
@aliases = [] if @aliases == UNSET_VALUE
@ip_resolver = nil if @ip_resolver == UNSET_VALUE
@aliases = [ @aliases ].flatten
end