Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
amontalban committed Jul 8, 2016
1 parent b10bb87 commit 09ef519
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/vagrant-hostmanager/action/update_all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def call(env)
@app.call(env)

# update /etc/hosts file on active machines
if @machine.config.hostmanager.manage_guest?
if @config.hostmanager.manage_guest?
env[:ui].info I18n.t('vagrant_hostmanager.action.update_guests')
@global_env.active_machines.each do |name, p|
if p == @provider
Expand All @@ -38,7 +38,7 @@ def call(env)
end

# update /etc/hosts files on host if enabled
if @machine.config.hostmanager.manage_host?
if @config.hostmanager.manage_host?
env[:ui].info I18n.t('vagrant_hostmanager.action.update_host')
@updater.update_host
end
Expand Down
24 changes: 24 additions & 0 deletions lib/vagrant-hostmanager/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,30 @@ def initialize
@ip_resolver = UNSET_VALUE
end

def merge(other)
super.tap do |result|
@enabled = false if @enabled == UNSET_VALUE
other.enabled = false if other.enabled == UNSET_VALUE
result.enabled = [@enabled, other.enabled].any?

@manage_host = false if @manage_host == UNSET_VALUE
other.manage_host = false if other.manage_host == UNSET_VALUE
result.manage_host = [@manage_host, other.manage_host].any?

@manage_guest = true if @manage_guest == UNSET_VALUE
other.manage_guest = true if other.manage_guest == UNSET_VALUE
result.manage_guest = [@manage_guest, other.manage_guest].any?

@ignore_private_ip = false if @ignore_private_ip == UNSET_VALUE
other.ignore_private_ip = false if other.ignore_private_ip == UNSET_VALUE
result.ignore_private_ip = [@ignore_private_ip, other.ignore_private_ip].any?

@include_offline = false if @include_offline == UNSET_VALUE
other.include_offline = false if other.include_offline == UNSET_VALUE
result.include_offline = [@include_offline, other.include_offline].any?
end
end

def finalize!
@enabled = false if @enabled == UNSET_VALUE
@manage_host = false if @manage_host == UNSET_VALUE
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-hostmanager/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Util
def self.get_config(env)
# config_global has been removed from v1.5
if Gem::Version.new(::Vagrant::VERSION) >= Gem::Version.new('1.5')
env.vagrantfile.config
env.vagrantfile.config[:hostmanager]
else
env.config_global
end
Expand Down

0 comments on commit 09ef519

Please sign in to comment.