diff --git a/Gemfile b/Gemfile index 052a8bc..137bac0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' group :development do - gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git', :tag => 'v1.2.2' + gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git', :tag => 'v1.2.7' end gemspec diff --git a/lib/vagrant-hostmanager/hosts_file.rb b/lib/vagrant-hostmanager/hosts_file.rb index a62b79c..662a9bc 100644 --- a/lib/vagrant-hostmanager/hosts_file.rb +++ b/lib/vagrant-hostmanager/hosts_file.rb @@ -72,21 +72,20 @@ module VagrantPlugins end def get_machines - machines = [] - @global_env.machine_names.each do |name| - begin - machine = @global_env.machine(name, @provider) - - # check if offline machines should be included in host entries - if @global_env.config_global.hostmanager.include_offline? || machine.state.id == :running + if @global_env.config_global.hostmanager.include_offline? + machines = [] + @global_env.machine_names.each do |name| + begin + @global_env.machine(name, @provider) machines << [name, @provider] + rescue Vagrant::Errors::MachineNotFound end - rescue Vagrant::Errors::MachineNotFound end + machines + else + @global_env.active_machines end - machines end - end end end