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:
parent
f3e2708144
commit
f189fb68cf
2
Gemfile
2
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue