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