require 'vagrant-hostmanager/hosts_file'

module VagrantPlugins
  module HostManager
    module Action
      class UpdateAll
        include HostsFile

        def initialize(app, env)
          @app = app
          @machine = env[:machine]
          @global_env = @machine.env
          @provider = @machine.provider_name
          @logger = Log4r::Logger.new('vagrant::hostmanager::update_all')
        end

        def call(env)
          # skip if machine is already active on up action
          return @app.call(env) if @machine.id && env[:machine_action] == :up
          # skip if machine is not active on destroy action
          return @app.call(env) if !@machine.id && env[:machine_action] == :destroy

          # check config to see if the hosts file should be update automatically
          return @app.call(env) unless @machine.config.hostmanager.enabled?
          @logger.info 'Updating /etc/hosts file automatically'

          @app.call(env)

          # update /etc/hosts file on active machines
          env[:ui].info I18n.t('vagrant_hostmanager.action.update_guests')
          @global_env.active_machines.each do |name, p|
            if p == @provider
              machine = @global_env.machine(name, p)
              update_guest(machine)
            end
          end

          # update /etc/hosts files on host if enabled
          if @machine.config.hostmanager.manage_host?
            env[:ui].info I18n.t('vagrant_hostmanager.action.update_host')
            update_host
          end
        end
      end
    end
  end
end

require 'vagrant-hostmanager/hosts_file'

module VagrantPlugins
  module HostManager
    module Action
      class UpdateAll
        include HostsFile

        def initialize(app, env)
          @app = app
          @machine = env[:machine]
          @global_env = @machine.env
          @provider = @machine.provider_name
          @logger = Log4r::Logger.new('vagrant::hostmanager::update_all')
        end

        def call(env)
          # skip if machine is already active on up action
          return @app.call(env) if @machine.id && env[:machine_action] == :up
          # skip if machine is not active on destroy action
          return @app.call(env) if !@machine.id && env[:machine_action] == :destroy

          # check config to see if the hosts file should be update automatically
          return @app.call(env) unless @global_env.config_global.hostmanager.enabled?
          @logger.info 'Updating /etc/hosts file automatically'

          @app.call(env)

          # update /etc/hosts file on active machines
          env[:ui].info I18n.t('vagrant_hostmanager.action.update_guests')
          @global_env.active_machines.each do |name, p|
            if p == @provider
              machine = @global_env.machine(name, p)
              update_guest(machine)
            end
          end

          # update /etc/hosts files on host if enabled
          if @machine.config.hostmanager.manage_host?
            env[:ui].info I18n.t('vagrant_hostmanager.action.update_host')
            update_host
          end
        end
      end
    end
  end
end

Check global.enabled instead of machine.enabled
Check global.enabled instead of machine.enabled

update_all.rb checks if @machine.config.hostmanager.enabled is set to true.
The default value of @enabled is set to false by config.rb.
If the Vagrantfile has a global value of true for enabled but it sets vm
specific hostmanager options, such as when specifying hostmanager.aliases,
then the @machine.config.hostmanager.enabled will default to false and
hostmanager will not think it is enabled.

Check @global_env.config_global.hostmanager.enabled instead.
