Skip to content

Commit

Permalink
Fix issue #26.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
smdahlen committed Jul 19, 2013
1 parent 46affe8 commit 063c749
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/vagrant-hostmanager/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ class Config < Vagrant.plugin('2', :config)
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
@aliases = []
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
Expand Down Expand Up @@ -50,7 +49,8 @@ def validate(machine)
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
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-hostmanager/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module VagrantPlugins
module HostManager
VERSION = '1.0.1'
VERSION = '1.0.2'
end
end

0 comments on commit 063c749

Please sign in to comment.