core: MachineIndex#vagrant_env should silence warnings
This commit is contained in:
parent
2b07dec059
commit
d42d62ead1
|
@ -3,6 +3,8 @@ require "pathname"
|
|||
require "securerandom"
|
||||
require "thread"
|
||||
|
||||
require "vagrant/util/silence_warnings"
|
||||
|
||||
module Vagrant
|
||||
# MachineIndex is able to manage the index of created Vagrant environments
|
||||
# in a central location.
|
||||
|
@ -383,11 +385,13 @@ module Vagrant
|
|||
#
|
||||
# @return [Vagrant::Environment]
|
||||
def vagrant_env(home_path, **opts)
|
||||
Environment.new({
|
||||
cwd: @vagrantfile_path,
|
||||
home_path: home_path,
|
||||
vagrantfile_name: @vagrantfile_name,
|
||||
}.merge(opts))
|
||||
Vagrant::Util::SilenceWarnings.silence! do
|
||||
Environment.new({
|
||||
cwd: @vagrantfile_path,
|
||||
home_path: home_path,
|
||||
vagrantfile_name: @vagrantfile_name,
|
||||
}.merge(opts))
|
||||
end
|
||||
end
|
||||
|
||||
# Converts to the structure used by the JSON
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require 'log4r'
|
||||
|
||||
require "vagrant/util/safe_puts"
|
||||
require "vagrant/util/silence_warnings"
|
||||
|
||||
module Vagrant
|
||||
module Plugin
|
||||
|
@ -134,13 +133,9 @@ module Vagrant
|
|||
# machine in that environment. We silence warnings here because
|
||||
# Vagrantfiles often have constants, so people would otherwise
|
||||
# constantly (heh) get "already initialized constant" warnings.
|
||||
machine = Vagrant::Util::SilenceWarnings.silence! do
|
||||
env = entry.vagrant_env(
|
||||
@env.home_path, ui_class: @env.ui_class)
|
||||
env.machine(entry.name.to_sym, entry.provider.to_sym)
|
||||
end
|
||||
|
||||
next machine
|
||||
env = entry.vagrant_env(
|
||||
@env.home_path, ui_class: @env.ui_class)
|
||||
next env.machine(entry.name.to_sym, entry.provider.to_sym)
|
||||
end
|
||||
|
||||
active_machines.each do |active_name, active_provider|
|
||||
|
|
Loading…
Reference in New Issue