From 063c749fe5601a4b387624b53b0ebbd8b42fd709 Mon Sep 17 00:00:00 2001 From: Shawn Dahlen Date: Fri, 19 Jul 2013 11:40:01 -0400 Subject: [PATCH] Fix issue #26. This commits adds a check in the config validation to allow for UNSET_VALUE for boolean attributes. This is required when finalize is not executed. --- lib/vagrant-hostmanager/config.rb | 6 +++--- lib/vagrant-hostmanager/version.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/vagrant-hostmanager/config.rb b/lib/vagrant-hostmanager/config.rb index 997b92e..a553d6c 100644 --- a/lib/vagrant-hostmanager/config.rb +++ b/lib/vagrant-hostmanager/config.rb @@ -12,7 +12,7 @@ module VagrantPlugins alias_method :manage_host?, :manage_host def initialize - @enabled = UNSET_VALUE + @enabled = false @manage_host = UNSET_VALUE @ignore_private_ip = UNSET_VALUE @include_offline = UNSET_VALUE @@ -20,7 +20,6 @@ module VagrantPlugins end def finalize! - @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 @@ -50,7 +49,8 @@ module VagrantPlugins private def validate_bool(key, value) - if ![TrueClass, FalseClass].include?(value.class) + if ![TrueClass, FalseClass].include?(value.class) && + value != UNSET_VALUE I18n.t('vagrant_hostmanager.config.not_a_bool', { :config_key => key, :value => value.class.to_s diff --git a/lib/vagrant-hostmanager/version.rb b/lib/vagrant-hostmanager/version.rb index 5fa8a24..1b4adfe 100644 --- a/lib/vagrant-hostmanager/version.rb +++ b/lib/vagrant-hostmanager/version.rb @@ -1,5 +1,5 @@ module VagrantPlugins module HostManager - VERSION = '1.0.1' + VERSION = '1.0.2' end end