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'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
group :development do
|
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
|
end
|
||||||
|
|
||||||
gemspec
|
gemspec
|
||||||
|
|
|
@ -72,21 +72,20 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_machines
|
def get_machines
|
||||||
|
if @global_env.config_global.hostmanager.include_offline?
|
||||||
machines = []
|
machines = []
|
||||||
@global_env.machine_names.each do |name|
|
@global_env.machine_names.each do |name|
|
||||||
begin
|
begin
|
||||||
machine = @global_env.machine(name, @provider)
|
@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
|
|
||||||
machines << [name, @provider]
|
machines << [name, @provider]
|
||||||
end
|
|
||||||
rescue Vagrant::Errors::MachineNotFound
|
rescue Vagrant::Errors::MachineNotFound
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
machines
|
machines
|
||||||
end
|
else
|
||||||
|
@global_env.active_machines
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue