Fix hardcoding of active state.

This commit queries the environment for active machines instead of
relying on a certain machine state. This fixes support for other Vagrant
providers.
This commit is contained in:
Shawn Dahlen 2013-08-22 16:45:39 -04:00
parent f3e2708144
commit f189fb68cf
2 changed files with 10 additions and 11 deletions

View File

@ -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

View File

@ -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