Use Ruby's resolver by default and allow replace to be disabled

This commit is contained in:
Chris Roberts 2018-01-22 10:40:33 -08:00
parent 81c855b797
commit 522d503030
3 changed files with 28 additions and 0 deletions

View File

@ -254,6 +254,12 @@ if I18n.config.respond_to?(:enforce_available_locales=)
I18n.config.enforce_available_locales = true
end
if Vagrant.enable_resolv_replace
global_logger.info("resolv replacement has been enabled!")
else
global_logger.warn("resolv replacement has not been enabled!")
end
# Setup the plugin manager and load any defined plugins
require_relative "vagrant/plugin/manager"
plugins = Vagrant::Plugin::Manager.instance.installed_plugins

View File

@ -129,4 +129,20 @@ module Vagrant
true
end
end
# Use Ruby Resolv in place of libc
#
# @return [boolean] enabled or not
def self.enable_resolv_replace
if !ENV["VAGRANT_DISABLE_RESOLV_REPLACE"]
begin
require "resolv-replace"
true
rescue
false
end
else
false
end
end
end

View File

@ -218,3 +218,9 @@ If set, this will disable the ability to create symlinks with all virtualbox
shared folders. Defaults to true if the option is not set. This can be overriden
on a per-folder basis within your Vagrantfile config by settings the
`SharedFoldersEnableSymlinksCreate` option to true.
## `VAGRANT_DISABLE_RESOLV_REPLACE`
Vagrant will automatically load `resolv-replace` to use Ruby's Resolv library
in place of the libc resolver. This behavior can be disabled by setting this
environment variable.