From f113535fe831ea62abb82b3935a1b0853337e200 Mon Sep 17 00:00:00 2001 From: Paulo Bittencourt Date: Mon, 26 May 2014 13:57:11 -0400 Subject: [PATCH] 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. --- lib/vagrant-hostmanager/config.rb | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/vagrant-hostmanager/config.rb b/lib/vagrant-hostmanager/config.rb index b44febd..4e3d3dc 100644 --- a/lib/vagrant-hostmanager/config.rb +++ b/lib/vagrant-hostmanager/config.rb @@ -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