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.
This commit is contained in:
Shawn Dahlen 2013-07-19 11:40:01 -04:00
parent 46affe82c8
commit 063c749fe5
2 changed files with 4 additions and 4 deletions

View File

@ -12,7 +12,7 @@ module VagrantPlugins
alias_method :manage_host?, :manage_host alias_method :manage_host?, :manage_host
def initialize def initialize
@enabled = UNSET_VALUE @enabled = false
@manage_host = UNSET_VALUE @manage_host = UNSET_VALUE
@ignore_private_ip = UNSET_VALUE @ignore_private_ip = UNSET_VALUE
@include_offline = UNSET_VALUE @include_offline = UNSET_VALUE
@ -20,7 +20,6 @@ module VagrantPlugins
end end
def finalize! def finalize!
@enabled = false if @enabled == UNSET_VALUE
@manage_host = false if @manage_host == UNSET_VALUE @manage_host = false if @manage_host == UNSET_VALUE
@ignore_private_ip = false if @ignore_private_ip == UNSET_VALUE @ignore_private_ip = false if @ignore_private_ip == UNSET_VALUE
@include_offline = false if @include_offline == UNSET_VALUE @include_offline = false if @include_offline == UNSET_VALUE
@ -50,7 +49,8 @@ module VagrantPlugins
private private
def validate_bool(key, value) 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', { I18n.t('vagrant_hostmanager.config.not_a_bool', {
:config_key => key, :config_key => key,
:value => value.class.to_s :value => value.class.to_s

View File

@ -1,5 +1,5 @@
module VagrantPlugins module VagrantPlugins
module HostManager module HostManager
VERSION = '1.0.1' VERSION = '1.0.2'
end end
end end