diff --git a/bin/vagrant b/bin/vagrant index aad4c0436ef..198078b2ced 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -10,16 +10,6 @@ if Thread.respond_to?(:report_on_exception=) Thread.report_on_exception = false end -# Activate all the runtime dependencies before -# moving on. -begin - Gem::Specification.find_by_name("vagrant").runtime_dependencies.each do |dep| - gem(dep.name, dep.requirement.as_list) - end -rescue Gem::MissingSpecError - $stderr.puts "WARN: Failed to locate vagrant specification for dependency loading" -end - # Split arguments by "--" if its there, we'll recombine them later argv = ARGV.dup argv_extra = [] @@ -117,7 +107,6 @@ end env = nil begin - require 'log4r' require 'vagrant' require 'vagrant/bundler' require 'vagrant/cli' diff --git a/lib/vagrant.rb b/lib/vagrant.rb index f790039d33b..f670310b30b 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -1,14 +1,19 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" + +# Load the shared helpers first to make the custom +# require helper available. +require "vagrant/shared_helpers" + +Vagrant.require "log4r" # Add patches to log4r to support trace level -require "vagrant/patches/log4r" -require "vagrant/patches/net-ssh" -require "vagrant/patches/rubygems" +Vagrant.require "vagrant/patches/log4r" +Vagrant.require "vagrant/patches/net-ssh" +Vagrant.require "vagrant/patches/rubygems" # Set our log levels and include trace -require 'log4r/configurator' +Vagrant.require 'log4r/configurator' Log4r::Configurator.custom_levels(*(["TRACE"] + Log4r::Log4rConfig::LogLevels)) # Update the default formatter within the log4r library to ensure @@ -20,7 +25,7 @@ def format_object(obj) end end -require "optparse" +Vagrant.require "optparse" module Vagrant # This is a customized OptionParser for Vagrant plugins. It @@ -45,10 +50,9 @@ module VagrantPlugins end # Load in our helpers and utilities -require "vagrant/shared_helpers" -require "rubygems" -require "vagrant/util" -require "vagrant/plugin/manager" +Vagrant.require "rubygems" +Vagrant.require "vagrant/util" +Vagrant.require "vagrant/plugin/manager" # Enable logging if it is requested. We do this before # anything else so that we can setup the output before @@ -105,19 +109,19 @@ def << msg end end -require 'json' -require 'pathname' -require 'stringio' +Vagrant.require 'json' +Vagrant.require 'pathname' +Vagrant.require 'stringio' -require 'childprocess' -require 'i18n' +Vagrant.require 'childprocess' +Vagrant.require 'i18n' # OpenSSL must be loaded here since when it is loaded via `autoload` # there are issues with ciphers not being properly loaded. -require 'openssl' +Vagrant.require 'openssl' # Always make the version available -require 'vagrant/version' +Vagrant.require 'vagrant/version' global_logger = Log4r::Logger.new("vagrant::global") Vagrant.global_logger = global_logger global_logger.info("Vagrant version: #{Vagrant::VERSION}") @@ -138,7 +142,7 @@ def << msg if vagrant_ssl_locations.any? { |f| File.exist?(f) } global_logger.debug("vagrant ssl helper found for loading ssl providers") begin - require "vagrant/vagrant_ssl" + Vagrant.require "vagrant/vagrant_ssl" Vagrant.vagrant_ssl_load global_logger.debug("ssl providers successfully loaded") rescue LoadError => err @@ -152,8 +156,8 @@ def << msg # We need these components always so instead of an autoload we # just require them explicitly here. -require "vagrant/plugin" -require "vagrant/registry" +Vagrant.require "vagrant/plugin" +Vagrant.require "vagrant/registry" module Vagrant autoload :Action, 'vagrant/action' @@ -230,7 +234,7 @@ def self.has_plugin?(name, version=nil) end # Now check the plugin gem names - require "vagrant/plugin/manager" + Vagrant.require "vagrant/plugin/manager" Plugin::Manager.instance.plugin_installed?(name, version) end diff --git a/lib/vagrant/action.rb b/lib/vagrant/action.rb index da987fe8fde..d7b82156d36 100644 --- a/lib/vagrant/action.rb +++ b/lib/vagrant/action.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'vagrant/action/builder' +Vagrant.require 'vagrant/action/builder' module Vagrant module Action diff --git a/lib/vagrant/action/builtin/box_add.rb b/lib/vagrant/action/builtin/box_add.rb index f04b8b86127..38a756b4f6e 100644 --- a/lib/vagrant/action/builtin/box_add.rb +++ b/lib/vagrant/action/builtin/box_add.rb @@ -1,16 +1,16 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/sha1" -require "log4r" -require "pathname" -require "uri" - -require "vagrant/box_metadata" -require "vagrant/util/downloader" -require "vagrant/util/file_checksum" -require "vagrant/util/file_mutex" -require "vagrant/util/platform" +Vagrant.require "digest/sha1" +Vagrant.require "log4r" +Vagrant.require "pathname" +Vagrant.require "uri" + +Vagrant.require "vagrant/box_metadata" +Vagrant.require "vagrant/util/downloader" +Vagrant.require "vagrant/util/file_checksum" +Vagrant.require "vagrant/util/file_mutex" +Vagrant.require "vagrant/util/platform" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/box_check_outdated.rb b/lib/vagrant/action/builtin/box_check_outdated.rb index 25f1b9ff44e..809113952b7 100644 --- a/lib/vagrant/action/builtin/box_check_outdated.rb +++ b/lib/vagrant/action/builtin/box_check_outdated.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/box_remove.rb b/lib/vagrant/action/builtin/box_remove.rb index f103284076a..55ffaaccbdd 100644 --- a/lib/vagrant/action/builtin/box_remove.rb +++ b/lib/vagrant/action/builtin/box_remove.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/box_update.rb b/lib/vagrant/action/builtin/box_update.rb index 8f675669a8f..371b574874f 100644 --- a/lib/vagrant/action/builtin/box_update.rb +++ b/lib/vagrant/action/builtin/box_update.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/cleanup_disks.rb b/lib/vagrant/action/builtin/cleanup_disks.rb index 0281142d7be..272ada2db77 100644 --- a/lib/vagrant/action/builtin/cleanup_disks.rb +++ b/lib/vagrant/action/builtin/cleanup_disks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" +Vagrant.require "json" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/cloud_init_setup.rb b/lib/vagrant/action/builtin/cloud_init_setup.rb index 6791ab739c4..8e05aa73de3 100644 --- a/lib/vagrant/action/builtin/cloud_init_setup.rb +++ b/lib/vagrant/action/builtin/cloud_init_setup.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'vagrant/util/mime' -require 'tmpdir' +Vagrant.require 'vagrant/util/mime' +Vagrant.require 'tmpdir' module Vagrant module Action diff --git a/lib/vagrant/action/builtin/cloud_init_wait.rb b/lib/vagrant/action/builtin/cloud_init_wait.rb index 93ef44faae5..5d3c465017b 100644 --- a/lib/vagrant/action/builtin/cloud_init_wait.rb +++ b/lib/vagrant/action/builtin/cloud_init_wait.rb @@ -1,6 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 +Vagrant.require "log4r" + module Vagrant module Action module Builtin diff --git a/lib/vagrant/action/builtin/config_validate.rb b/lib/vagrant/action/builtin/config_validate.rb index ad315830abb..484b625801c 100644 --- a/lib/vagrant/action/builtin/config_validate.rb +++ b/lib/vagrant/action/builtin/config_validate.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/util/template_renderer" +Vagrant.require "vagrant/util/template_renderer" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/disk.rb b/lib/vagrant/action/builtin/disk.rb index a6b1e700a95..ce9d3b723f8 100644 --- a/lib/vagrant/action/builtin/disk.rb +++ b/lib/vagrant/action/builtin/disk.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" +Vagrant.require "json" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/graceful_halt.rb b/lib/vagrant/action/builtin/graceful_halt.rb index 34b8268be08..02119237cbe 100644 --- a/lib/vagrant/action/builtin/graceful_halt.rb +++ b/lib/vagrant/action/builtin/graceful_halt.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "timeout" +Vagrant.require "log4r" +Vagrant.require "timeout" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/handle_box.rb b/lib/vagrant/action/builtin/handle_box.rb index c2864098186..5166f30420b 100644 --- a/lib/vagrant/action/builtin/handle_box.rb +++ b/lib/vagrant/action/builtin/handle_box.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "thread" - -require "log4r" +Vagrant.require "thread" +Vagrant.require "log4r" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb b/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb index cb93902bb87..c9fa92b7230 100644 --- a/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb +++ b/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb @@ -1,13 +1,12 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "set" +Vagrant.require "set" +Vagrant.require "log4r" +Vagrant.require "socket" -require "log4r" -require "socket" - -require "vagrant/util/is_port_open" -require "vagrant/util/ipv4_interfaces" +Vagrant.require "vagrant/util/is_port_open" +Vagrant.require "vagrant/util/ipv4_interfaces" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/lock.rb b/lib/vagrant/action/builtin/lock.rb index 8df79c81233..fdba1223c61 100644 --- a/lib/vagrant/action/builtin/lock.rb +++ b/lib/vagrant/action/builtin/lock.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/mixin_synced_folders.rb b/lib/vagrant/action/builtin/mixin_synced_folders.rb index 3f33352cf33..bf382cd7427 100644 --- a/lib/vagrant/action/builtin/mixin_synced_folders.rb +++ b/lib/vagrant/action/builtin/mixin_synced_folders.rb @@ -1,10 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" -require "set" - -require 'vagrant/util/scoped_hash_override' +Vagrant.require "json" +Vagrant.require "set" +Vagrant.require 'vagrant/util/scoped_hash_override' module Vagrant module Action diff --git a/lib/vagrant/action/builtin/prepare_clone.rb b/lib/vagrant/action/builtin/prepare_clone.rb index 51fb36b3068..bca583480ad 100644 --- a/lib/vagrant/action/builtin/prepare_clone.rb +++ b/lib/vagrant/action/builtin/prepare_clone.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/provision.rb b/lib/vagrant/action/builtin/provision.rb index 776f6c7dc89..591539138e4 100644 --- a/lib/vagrant/action/builtin/provision.rb +++ b/lib/vagrant/action/builtin/provision.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" require_relative "mixin_provisioners" diff --git a/lib/vagrant/action/builtin/provisioner_cleanup.rb b/lib/vagrant/action/builtin/provisioner_cleanup.rb index 573734b7441..2975fac6e89 100644 --- a/lib/vagrant/action/builtin/provisioner_cleanup.rb +++ b/lib/vagrant/action/builtin/provisioner_cleanup.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" require_relative "mixin_provisioners" diff --git a/lib/vagrant/action/builtin/set_hostname.rb b/lib/vagrant/action/builtin/set_hostname.rb index b1fe4c38b6e..d659c104d63 100644 --- a/lib/vagrant/action/builtin/set_hostname.rb +++ b/lib/vagrant/action/builtin/set_hostname.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/ssh_exec.rb b/lib/vagrant/action/builtin/ssh_exec.rb index caa4cd45b88..0cba2448533 100644 --- a/lib/vagrant/action/builtin/ssh_exec.rb +++ b/lib/vagrant/action/builtin/ssh_exec.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" +Vagrant.require "pathname" -require "vagrant/util/ssh" +Vagrant.require "vagrant/util/ssh" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/ssh_run.rb b/lib/vagrant/action/builtin/ssh_run.rb index 7123d23f0fd..9f94664359f 100644 --- a/lib/vagrant/action/builtin/ssh_run.rb +++ b/lib/vagrant/action/builtin/ssh_run.rb @@ -1,11 +1,11 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" -require "vagrant/util/platform" -require "vagrant/util/ssh" -require "vagrant/util/shell_quote" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/ssh" +Vagrant.require "vagrant/util/shell_quote" module Vagrant module Action diff --git a/lib/vagrant/action/builtin/synced_folder_cleanup.rb b/lib/vagrant/action/builtin/synced_folder_cleanup.rb index 22aab95fdda..b5b46f3bd57 100644 --- a/lib/vagrant/action/builtin/synced_folder_cleanup.rb +++ b/lib/vagrant/action/builtin/synced_folder_cleanup.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" require_relative "mixin_synced_folders" diff --git a/lib/vagrant/action/builtin/synced_folders.rb b/lib/vagrant/action/builtin/synced_folders.rb index be11dce98a5..5d9c7f22332 100644 --- a/lib/vagrant/action/builtin/synced_folders.rb +++ b/lib/vagrant/action/builtin/synced_folders.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" -require 'vagrant/util/platform' +Vagrant.require 'vagrant/util/platform' require_relative "mixin_synced_folders" diff --git a/lib/vagrant/action/general/package.rb b/lib/vagrant/action/general/package.rb index 0daa7f76d00..0dd734289bd 100644 --- a/lib/vagrant/action/general/package.rb +++ b/lib/vagrant/action/general/package.rb @@ -1,12 +1,11 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'fileutils' -require "pathname" - -require 'vagrant/util/safe_chdir' -require 'vagrant/util/subprocess' -require 'vagrant/util/presence' +Vagrant.require 'fileutils' +Vagrant.require "pathname" +Vagrant.require 'vagrant/util/safe_chdir' +Vagrant.require 'vagrant/util/subprocess' +Vagrant.require 'vagrant/util/presence' module Vagrant module Action diff --git a/lib/vagrant/action/general/package_setup_folders.rb b/lib/vagrant/action/general/package_setup_folders.rb index f31b6d74a86..32084b3eee1 100644 --- a/lib/vagrant/action/general/package_setup_folders.rb +++ b/lib/vagrant/action/general/package_setup_folders.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" +Vagrant.require "fileutils" require_relative "package" module Vagrant diff --git a/lib/vagrant/action/runner.rb b/lib/vagrant/action/runner.rb index 67f5aa8c89e..a26c531e3be 100644 --- a/lib/vagrant/action/runner.rb +++ b/lib/vagrant/action/runner.rb @@ -1,11 +1,11 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'log4r' +Vagrant.require 'log4r' -require 'vagrant/action/hook' -require 'vagrant/util/busy' -require 'vagrant/util/experimental' +Vagrant.require 'vagrant/action/hook' +Vagrant.require 'vagrant/util/busy' +Vagrant.require 'vagrant/util/experimental' module Vagrant module Action diff --git a/lib/vagrant/action/warden.rb b/lib/vagrant/action/warden.rb index 33a27147993..0e04b311faf 100644 --- a/lib/vagrant/action/warden.rb +++ b/lib/vagrant/action/warden.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require 'vagrant/util/experimental' +Vagrant.require "log4r" +Vagrant.require 'vagrant/util/experimental' module Vagrant module Action diff --git a/lib/vagrant/alias.rb b/lib/vagrant/alias.rb index deff2369945..50fa52e7eb8 100644 --- a/lib/vagrant/alias.rb +++ b/lib/vagrant/alias.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/registry" +Vagrant.require "vagrant/registry" module Vagrant # This class imports and processes CLI aliases stored in ~/.vagrant.d/aliases diff --git a/lib/vagrant/batch_action.rb b/lib/vagrant/batch_action.rb index dd42d3b51aa..21ca77189af 100644 --- a/lib/vagrant/batch_action.rb +++ b/lib/vagrant/batch_action.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'thread' - -require "log4r" +Vagrant.require 'thread' +Vagrant.require "log4r" module Vagrant # This class executes multiple actions as a single batch, parallelizing diff --git a/lib/vagrant/box.rb b/lib/vagrant/box.rb index 3f636a9e465..f47a4573835 100644 --- a/lib/vagrant/box.rb +++ b/lib/vagrant/box.rb @@ -1,17 +1,17 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'fileutils' -require "tempfile" +Vagrant.require 'fileutils' +Vagrant.require "tempfile" -require "json" -require "log4r" +Vagrant.require "json" +Vagrant.require "log4r" -require "vagrant/box_metadata" -require "vagrant/util/downloader" -require "vagrant/util/platform" -require "vagrant/util/safe_chdir" -require "vagrant/util/subprocess" +Vagrant.require "vagrant/box_metadata" +Vagrant.require "vagrant/util/downloader" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/safe_chdir" +Vagrant.require "vagrant/util/subprocess" module Vagrant # Represents a "box," which is a package Vagrant environment that is used diff --git a/lib/vagrant/box_collection.rb b/lib/vagrant/box_collection.rb index 6666edae8ba..c9a37c4f601 100644 --- a/lib/vagrant/box_collection.rb +++ b/lib/vagrant/box_collection.rb @@ -1,15 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/sha1" -require "fileutils" -require "monitor" -require "tmpdir" - -require "log4r" - -require "vagrant/util/platform" -require "vagrant/util/subprocess" +Vagrant.require "digest/sha1" +Vagrant.require "fileutils" +Vagrant.require "monitor" +Vagrant.require "tmpdir" +Vagrant.require "log4r" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/subprocess" module Vagrant # Represents a collection a boxes found on disk. This provides methods diff --git a/lib/vagrant/box_metadata.rb b/lib/vagrant/box_metadata.rb index b66580cb7d7..0a0e8f9d897 100644 --- a/lib/vagrant/box_metadata.rb +++ b/lib/vagrant/box_metadata.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" +Vagrant.require "json" module Vagrant # BoxMetadata represents metadata about a box, including the name diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb index 79ee6aaf8e1..167c0d16eb1 100644 --- a/lib/vagrant/bundler.rb +++ b/lib/vagrant/bundler.rb @@ -1,16 +1,16 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "monitor" -require "pathname" -require "set" -require "tempfile" -require "fileutils" -require "uri" - -require "rubygems/package" -require "rubygems/uninstaller" -require "rubygems/name_tuple" +Vagrant.require "monitor" +Vagrant.require "pathname" +Vagrant.require "set" +Vagrant.require "tempfile" +Vagrant.require "fileutils" +Vagrant.require "uri" + +Vagrant.require "rubygems/package" +Vagrant.require "rubygems/uninstaller" +Vagrant.require "rubygems/name_tuple" require_relative "shared_helpers" require_relative "version" diff --git a/lib/vagrant/cli.rb b/lib/vagrant/cli.rb index 17eb86e271f..da6b29144d3 100644 --- a/lib/vagrant/cli.rb +++ b/lib/vagrant/cli.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'log4r' -require 'optparse' +Vagrant.require 'log4r' +Vagrant.require 'optparse' -require 'vagrant/util/experimental' +Vagrant.require 'vagrant/util/experimental' module Vagrant # Manages the command line interface to Vagrant. diff --git a/lib/vagrant/config.rb b/lib/vagrant/config.rb index 789ce37a82c..3ccce5c6f1e 100644 --- a/lib/vagrant/config.rb +++ b/lib/vagrant/config.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/registry" +Vagrant.require "vagrant/registry" module Vagrant module Config diff --git a/lib/vagrant/config/v1/loader.rb b/lib/vagrant/config/v1/loader.rb index b567b92cd79..a86a530323c 100644 --- a/lib/vagrant/config/v1/loader.rb +++ b/lib/vagrant/config/v1/loader.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/config/v1/root" +Vagrant.require "vagrant/config/v1/root" module Vagrant module Config diff --git a/lib/vagrant/config/v1/root.rb b/lib/vagrant/config/v1/root.rb index f8005f6e698..1fbc3d2251e 100644 --- a/lib/vagrant/config/v1/root.rb +++ b/lib/vagrant/config/v1/root.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "set" +Vagrant.require "set" module Vagrant module Config diff --git a/lib/vagrant/config/v2/loader.rb b/lib/vagrant/config/v2/loader.rb index beed6610514..f905ef8a6c8 100644 --- a/lib/vagrant/config/v2/loader.rb +++ b/lib/vagrant/config/v2/loader.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/config/v2/root" +Vagrant.require "vagrant/config/v2/root" module Vagrant module Config diff --git a/lib/vagrant/config/v2/root.rb b/lib/vagrant/config/v2/root.rb index cf2e5856b39..4f68d42929a 100644 --- a/lib/vagrant/config/v2/root.rb +++ b/lib/vagrant/config/v2/root.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "set" +Vagrant.require "set" -require "vagrant/config/v2/util" +Vagrant.require "vagrant/config/v2/util" module Vagrant module Config diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 24f6e191a1b..a916837c9b4 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -1,20 +1,20 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'fileutils' -require 'json' -require 'pathname' -require 'set' -require 'thread' - -require 'log4r' - -require 'vagrant/util/file_mode' -require 'vagrant/util/platform' -require 'vagrant/util/hash_with_indifferent_access' -require "vagrant/util/silence_warnings" -require "vagrant/vagrantfile" -require "vagrant/version" +Vagrant.require 'fileutils' +Vagrant.require 'json' +Vagrant.require 'pathname' +Vagrant.require 'set' +Vagrant.require 'thread' + +Vagrant.require 'log4r' + +Vagrant.require 'vagrant/util/file_mode' +Vagrant.require 'vagrant/util/platform' +Vagrant.require 'vagrant/util/hash_with_indifferent_access' +Vagrant.require "vagrant/util/silence_warnings" +Vagrant.require "vagrant/vagrantfile" +Vagrant.require "vagrant/version" module Vagrant # A "Vagrant environment" represents a configuration of how Vagrant diff --git a/lib/vagrant/environment/remote.rb b/lib/vagrant/environment/remote.rb index aeaafc7a348..eba3bdaae9e 100644 --- a/lib/vagrant/environment/remote.rb +++ b/lib/vagrant/environment/remote.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'vagrant/machine_index/remote' +Vagrant.require 'vagrant/machine_index/remote' module Vagrant class Environment diff --git a/lib/vagrant/guest.rb b/lib/vagrant/guest.rb index 6e86f7af964..920110b6cce 100644 --- a/lib/vagrant/guest.rb +++ b/lib/vagrant/guest.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" - -require "vagrant/capability_host" +Vagrant.require "log4r" +Vagrant.require "vagrant/capability_host" module Vagrant # This class handles guest-OS specific interactions with a machine. diff --git a/lib/vagrant/host.rb b/lib/vagrant/host.rb index 34944235626..04c43afc8a9 100644 --- a/lib/vagrant/host.rb +++ b/lib/vagrant/host.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/capability_host" +Vagrant.require "vagrant/capability_host" module Vagrant # This class handles host-OS specific interactions. It is responsible for diff --git a/lib/vagrant/machine.rb b/lib/vagrant/machine.rb index 7da6bb36593..766762e41a7 100644 --- a/lib/vagrant/machine.rb +++ b/lib/vagrant/machine.rb @@ -4,10 +4,9 @@ require_relative "./util/ssh" require_relative "./action/builtin/mixin_synced_folders" -require "digest/md5" -require "thread" - -require "log4r" +Vagrant.require "digest/md5" +Vagrant.require "thread" +Vagrant.require "log4r" module Vagrant # This represents a machine that Vagrant manages. This provides a singular diff --git a/lib/vagrant/machine/remote.rb b/lib/vagrant/machine/remote.rb index 8d3972a6db4..5c5144f98f9 100644 --- a/lib/vagrant/machine/remote.rb +++ b/lib/vagrant/machine/remote.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'ostruct' -require "vagrant/util/scoped_hash_override" +Vagrant.require 'ostruct' +Vagrant.require "vagrant/util/scoped_hash_override" module Vagrant class Machine diff --git a/lib/vagrant/machine_index.rb b/lib/vagrant/machine_index.rb index 188667aaa11..24d75a85fa8 100644 --- a/lib/vagrant/machine_index.rb +++ b/lib/vagrant/machine_index.rb @@ -1,12 +1,12 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" -require "pathname" -require "securerandom" -require "thread" +Vagrant.require "json" +Vagrant.require "pathname" +Vagrant.require "securerandom" +Vagrant.require "thread" -require "vagrant/util/silence_warnings" +Vagrant.require "vagrant/util/silence_warnings" module Vagrant # MachineIndex is able to manage the index of created Vagrant environments diff --git a/lib/vagrant/patches/fake_ftp.rb b/lib/vagrant/patches/fake_ftp.rb index 8831e3a8db3..73bd693aaea 100644 --- a/lib/vagrant/patches/fake_ftp.rb +++ b/lib/vagrant/patches/fake_ftp.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fake_ftp" +Vagrant.require "fake_ftp" module FakeFtp class File diff --git a/lib/vagrant/patches/log4r.rb b/lib/vagrant/patches/log4r.rb index 99bde895d47..3232495437a 100644 --- a/lib/vagrant/patches/log4r.rb +++ b/lib/vagrant/patches/log4r.rb @@ -6,7 +6,7 @@ # information should be included in the output, we # make some modifications to allow the trace check to # still work while also supporting trace as a valid level -require "log4r/loggerfactory" +Vagrant.require "log4r/loggerfactory" if !Log4r::Logger::LoggerFactory.respond_to?(:fake_define_methods) class Log4r::Logger::LoggerFactory diff --git a/lib/vagrant/patches/net-ssh.rb b/lib/vagrant/patches/net-ssh.rb index 4f505a2cea5..e6b3db4ceba 100644 --- a/lib/vagrant/patches/net-ssh.rb +++ b/lib/vagrant/patches/net-ssh.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "net/ssh" -require "net/ssh/buffer" +Vagrant.require "net/ssh" +Vagrant.require "net/ssh/buffer" # Set the version requirement for when net-ssh should be patched NET_SSH_PATCH_REQUIREMENT = Gem::Requirement.new(">= 7.0.0", "<= 7.3") diff --git a/lib/vagrant/plugin/manager.rb b/lib/vagrant/plugin/manager.rb index 8d568141a7c..d4a003f36f1 100644 --- a/lib/vagrant/plugin/manager.rb +++ b/lib/vagrant/plugin/manager.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "set" +Vagrant.require "pathname" +Vagrant.require "set" require_relative "../bundler" require_relative "../shared_helpers" diff --git a/lib/vagrant/plugin/remote.rb b/lib/vagrant/plugin/remote.rb index 3d684f55b36..1f92de9b5a3 100644 --- a/lib/vagrant/plugin/remote.rb +++ b/lib/vagrant/plugin/remote.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/remote/manager.rb b/lib/vagrant/plugin/remote/manager.rb index 1c199d9f81e..a6bd4aded67 100644 --- a/lib/vagrant/plugin/remote/manager.rb +++ b/lib/vagrant/plugin/remote/manager.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/state_file.rb b/lib/vagrant/plugin/state_file.rb index c514ca67c59..378ee7f2332 100644 --- a/lib/vagrant/plugin/state_file.rb +++ b/lib/vagrant/plugin/state_file.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" -require "fileutils" -require "tempfile" +Vagrant.require "json" +Vagrant.require "fileutils" +Vagrant.require "tempfile" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v1.rb b/lib/vagrant/plugin/v1.rb index 5aa9be4f900..b0527af28b4 100644 --- a/lib/vagrant/plugin/v1.rb +++ b/lib/vagrant/plugin/v1.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" - -require "vagrant/plugin/v1/errors" +Vagrant.require "log4r" +Vagrant.require "vagrant/plugin/v1/errors" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v1/command.rb b/lib/vagrant/plugin/v1/command.rb index b1bb636808a..b240d8ce6ee 100644 --- a/lib/vagrant/plugin/v1/command.rb +++ b/lib/vagrant/plugin/v1/command.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'log4r' - -require "vagrant/util/safe_puts" +Vagrant.require 'log4r' +Vagrant.require "vagrant/util/safe_puts" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v1/manager.rb b/lib/vagrant/plugin/v1/manager.rb index d4180ea8eef..8d1aeaba3a8 100644 --- a/lib/vagrant/plugin/v1/manager.rb +++ b/lib/vagrant/plugin/v1/manager.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v1/plugin.rb b/lib/vagrant/plugin/v1/plugin.rb index 2bab79c3620..69e953044c6 100644 --- a/lib/vagrant/plugin/v1/plugin.rb +++ b/lib/vagrant/plugin/v1/plugin.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "set" - -require "log4r" +Vagrant.require "set" +Vagrant.require "log4r" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v2.rb b/lib/vagrant/plugin/v2.rb index b9264ed691e..1da18fc7c93 100644 --- a/lib/vagrant/plugin/v2.rb +++ b/lib/vagrant/plugin/v2.rb @@ -1,12 +1,12 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" # We don't autoload components because if we're loading anything in the # V2 namespace anyways, then we're going to need the Components class. -require "vagrant/plugin/v2/components" -require "vagrant/plugin/v2/errors" +Vagrant.require "vagrant/plugin/v2/components" +Vagrant.require "vagrant/plugin/v2/errors" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v2/command.rb b/lib/vagrant/plugin/v2/command.rb index ffb61f7a5ba..d29d4f2a0eb 100644 --- a/lib/vagrant/plugin/v2/command.rb +++ b/lib/vagrant/plugin/v2/command.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'log4r' - -require "vagrant/util/safe_puts" +Vagrant.require 'log4r' +Vagrant.require "vagrant/util/safe_puts" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v2/communicator.rb b/lib/vagrant/plugin/v2/communicator.rb index 35acb8a0abf..58804fb0d6f 100644 --- a/lib/vagrant/plugin/v2/communicator.rb +++ b/lib/vagrant/plugin/v2/communicator.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "timeout" +Vagrant.require "timeout" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v2/config.rb b/lib/vagrant/plugin/v2/config.rb index 06352de2aa6..b0ed312ab9b 100644 --- a/lib/vagrant/plugin/v2/config.rb +++ b/lib/vagrant/plugin/v2/config.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "set" +Vagrant.require "set" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v2/manager.rb b/lib/vagrant/plugin/v2/manager.rb index 32218d4f8fc..9b01f3a56e7 100644 --- a/lib/vagrant/plugin/v2/manager.rb +++ b/lib/vagrant/plugin/v2/manager.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v2/plugin.rb b/lib/vagrant/plugin/v2/plugin.rb index b83a095e7b1..2d57a806a40 100644 --- a/lib/vagrant/plugin/v2/plugin.rb +++ b/lib/vagrant/plugin/v2/plugin.rb @@ -1,11 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "set" - -require "log4r" - -require "vagrant/plugin/v2/components" +Vagrant.require "set" +Vagrant.require "log4r" +Vagrant.require "vagrant/plugin/v2/components" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v2/provider.rb b/lib/vagrant/plugin/v2/provider.rb index 2d1c68a75f7..f13a050a9b0 100644 --- a/lib/vagrant/plugin/v2/provider.rb +++ b/lib/vagrant/plugin/v2/provider.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/capability_host" +Vagrant.require "vagrant/capability_host" module Vagrant module Plugin diff --git a/lib/vagrant/plugin/v2/trigger.rb b/lib/vagrant/plugin/v2/trigger.rb index 3f9abb55b8b..7e64bcaeb5e 100644 --- a/lib/vagrant/plugin/v2/trigger.rb +++ b/lib/vagrant/plugin/v2/trigger.rb @@ -1,14 +1,14 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'fileutils' -require 'log4r' -require 'shellwords' - -require Vagrant.source_root.join("plugins/provisioners/shell/provisioner") -require "vagrant/util/subprocess" -require "vagrant/util/platform" -require "vagrant/util/powershell" +Vagrant.require 'fileutils' +Vagrant.require 'log4r' +Vagrant.require 'shellwords' + +Vagrant.require Vagrant.source_root.join("plugins/provisioners/shell/provisioner") +Vagrant.require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/powershell" module Vagrant module Plugin diff --git a/lib/vagrant/shared_helpers.rb b/lib/vagrant/shared_helpers.rb index 45ebff2e0f4..be0baa31323 100644 --- a/lib/vagrant/shared_helpers.rb +++ b/lib/vagrant/shared_helpers.rb @@ -168,7 +168,7 @@ def self.enable_resolv_replace if ENV["VAGRANT_ENABLE_RESOLV_REPLACE"] if !ENV["VAGRANT_DISABLE_RESOLV_REPLACE"] begin - require "resolv-replace" + Vagrant.require "resolv-replace" true rescue false @@ -192,7 +192,7 @@ def self.global_logger=(log) # @return [Logger] def self.global_logger if @_global_logger.nil? - require "log4r" + Vagrant.require "log4r" @_global_logger = Log4r::Logger.new("vagrant::global") end @_global_logger @@ -226,6 +226,68 @@ def self.default_cli_options @_default_cli_options.dup end + # Loads the provided path. If the base of the path + # is a Vagrant runtime dependency, the gem will be + # activated with the proper constraint first. + # + # NOTE: This is currently disabled by default and + # will transition to enabled by default as more + # non-installer based environments are tested. + # + # @return [nil] + def self.require(path) + catch(:activation_complete) do + # If activation is not enabled, don't attempt activation + throw :activation_complete if ENV["VAGRANT_ENABLE_GEM_ACTIVATION"].nil? + + # If it's a vagrant path, don't do anything. + throw :activation_complete if path.to_s.start_with?("vagrant/") + + # Attempt to fetch the vagrant specification + if @_vagrant_spec.nil? + @_vagrant_activated_dependencies = {} + begin + @_vagrant_spec = Gem::Specification.find_by_name("vagrant") + rescue Gem::MissingSpecError + # If it couldn't be found, print a warning to stderr and bail + if !@_spec_load_failure_warning + $stderr.puts "WARN: Failed to locate vagrant specification for dependency loading" + @_spec_load_failure_warning = true + end + + throw :activation_complete + end + end + + # Attempt to get the name of the gem by the given path + dep_name = Gem::Specification.find_by_path(path)&.name + + # Bail if a dependency name cannot be determined + throw :activation_complete if dep_name.nil? + + # Bail if already activated + throw :activation_complete if @_vagrant_activated_dependencies[dep_name] + + # Extract the dependency from the runtime dependency list + dependency = @_vagrant_spec.runtime_dependencies.detect do |d| + d.name == dep_name + end + + # If the dependency isn't found, bail + throw :activation_complete if dependency.nil? + + # Activate the gem + gem(dependency.name, dependency.requirement.as_list) +puts "Activated: #{dependency.name}" + @_vagrant_activated_dependencies[dependency.name] = true + end + + # Finally, require the provided path. + ::Kernel.require(path) + + nil + end + # Check if Vagrant is running in server mode # # @return [Boolean] diff --git a/lib/vagrant/ui.rb b/lib/vagrant/ui.rb index de4daff679d..7f6a675f94b 100644 --- a/lib/vagrant/ui.rb +++ b/lib/vagrant/ui.rb @@ -1,14 +1,12 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "delegate" -require "io/console" -require "thread" - -require "log4r" - -require "vagrant/util/platform" -require "vagrant/util/safe_puts" +Vagrant.require "delegate" +Vagrant.require "io/console" +Vagrant.require "thread" +Vagrant.require "log4r" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/safe_puts" module Vagrant module UI diff --git a/lib/vagrant/util/caps.rb b/lib/vagrant/util/caps.rb index 234335e1140..b9c340eb550 100644 --- a/lib/vagrant/util/caps.rb +++ b/lib/vagrant/util/caps.rb @@ -1,11 +1,11 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" -require "fileutils" -require "pathname" -require "vagrant/util/directory" -require "vagrant/util/subprocess" +Vagrant.require "tempfile" +Vagrant.require "fileutils" +Vagrant.require "pathname" +Vagrant.require "vagrant/util/directory" +Vagrant.require "vagrant/util/subprocess" module Vagrant module Util diff --git a/lib/vagrant/util/checkpoint_client.rb b/lib/vagrant/util/checkpoint_client.rb index 8480786cae4..bdf8f8ff245 100644 --- a/lib/vagrant/util/checkpoint_client.rb +++ b/lib/vagrant/util/checkpoint_client.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "singleton" +Vagrant.require "log4r" +Vagrant.require "singleton" module Vagrant module Util diff --git a/lib/vagrant/util/counter.rb b/lib/vagrant/util/counter.rb index f25a2cb112e..7e2c38d5ee4 100644 --- a/lib/vagrant/util/counter.rb +++ b/lib/vagrant/util/counter.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'thread' +Vagrant.require 'thread' module Vagrant module Util diff --git a/lib/vagrant/util/directory.rb b/lib/vagrant/util/directory.rb index 55e502eab76..2b561ab86c6 100644 --- a/lib/vagrant/util/directory.rb +++ b/lib/vagrant/util/directory.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'pathname' +Vagrant.require 'pathname' module Vagrant module Util diff --git a/lib/vagrant/util/downloader.rb b/lib/vagrant/util/downloader.rb index 6b197b71fee..4d96e460da0 100644 --- a/lib/vagrant/util/downloader.rb +++ b/lib/vagrant/util/downloader.rb @@ -1,18 +1,18 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "cgi" -require "uri" - -require "log4r" -require "digest" -require "digest/md5" -require "digest/sha1" -require "vagrant/util/busy" -require "vagrant/util/platform" -require "vagrant/util/subprocess" -require "vagrant/util/curl_helper" -require "vagrant/util/file_checksum" +Vagrant.require "cgi" +Vagrant.require "uri" + +Vagrant.require "log4r" +Vagrant.require "digest" +Vagrant.require "digest/md5" +Vagrant.require "digest/sha1" +Vagrant.require "vagrant/util/busy" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/curl_helper" +Vagrant.require "vagrant/util/file_checksum" module Vagrant module Util diff --git a/lib/vagrant/util/file_checksum.rb b/lib/vagrant/util/file_checksum.rb index 83409eb50e2..c6d4f8ae763 100644 --- a/lib/vagrant/util/file_checksum.rb +++ b/lib/vagrant/util/file_checksum.rb @@ -6,7 +6,7 @@ # the moment, and this class isn't directly used. It is merely here for # documentation of structure of the class. -require "vagrant/errors" +Vagrant.require "vagrant/errors" class DigestClass def update(string); end diff --git a/lib/vagrant/util/io.rb b/lib/vagrant/util/io.rb index a6eada0e3c8..0202c62271f 100644 --- a/lib/vagrant/util/io.rb +++ b/lib/vagrant/util/io.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/util/platform" +Vagrant.require "vagrant/util/platform" module Vagrant module Util diff --git a/lib/vagrant/util/is_port_open.rb b/lib/vagrant/util/is_port_open.rb index 8354dda4bf2..ec7c96b5f70 100644 --- a/lib/vagrant/util/is_port_open.rb +++ b/lib/vagrant/util/is_port_open.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "socket" +Vagrant.require "socket" module Vagrant module Util diff --git a/lib/vagrant/util/keypair.rb b/lib/vagrant/util/keypair.rb index c3ce48603c7..0e593306015 100644 --- a/lib/vagrant/util/keypair.rb +++ b/lib/vagrant/util/keypair.rb @@ -1,11 +1,11 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "base64" -require "ed25519" -require "securerandom" +Vagrant.require "base64" +Vagrant.require "ed25519" +Vagrant.require "securerandom" -require "vagrant/util/retryable" +Vagrant.require "vagrant/util/retryable" module Vagrant module Util diff --git a/lib/vagrant/util/logging_formatter.rb b/lib/vagrant/util/logging_formatter.rb index 41fc359fdda..b7944a48471 100644 --- a/lib/vagrant/util/logging_formatter.rb +++ b/lib/vagrant/util/logging_formatter.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/util/credential_scrubber" -require "log4r/formatter/formatter" +Vagrant.require "vagrant/util/credential_scrubber" +Vagrant.require "log4r/formatter/formatter" module Vagrant module Util diff --git a/lib/vagrant/util/mime.rb b/lib/vagrant/util/mime.rb index 8b1036c6dba..24de8dd88a6 100644 --- a/lib/vagrant/util/mime.rb +++ b/lib/vagrant/util/mime.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'mime/types' -require 'securerandom' +Vagrant.require 'mime/types' +Vagrant.require 'securerandom' module Vagrant module Util diff --git a/lib/vagrant/util/network_ip.rb b/lib/vagrant/util/network_ip.rb index a02752d9d1d..0d2ec0aaa11 100644 --- a/lib/vagrant/util/network_ip.rb +++ b/lib/vagrant/util/network_ip.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "ipaddr" +Vagrant.require "ipaddr" module Vagrant module Util diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index b99314c30f2..2070091ef51 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -1,15 +1,15 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "rbconfig" -require "shellwords" -require "tempfile" -require "tmpdir" -require "log4r" - -require "vagrant/util/subprocess" -require "vagrant/util/powershell" -require "vagrant/util/which" +Vagrant.require "rbconfig" +Vagrant.require "shellwords" +Vagrant.require "tempfile" +Vagrant.require "tmpdir" +Vagrant.require "log4r" + +Vagrant.require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/powershell" +Vagrant.require "vagrant/util/which" module Vagrant module Util diff --git a/lib/vagrant/util/powershell.rb b/lib/vagrant/util/powershell.rb index e2d2bad84da..134637ea8b3 100644 --- a/lib/vagrant/util/powershell.rb +++ b/lib/vagrant/util/powershell.rb @@ -1,8 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "base64" -require "tmpdir" +Vagrant.require "base64" +Vagrant.require "tmpdir" + require_relative "subprocess" require_relative "which" diff --git a/lib/vagrant/util/retryable.rb b/lib/vagrant/util/retryable.rb index 2e3ef18bfec..60cc8617be1 100644 --- a/lib/vagrant/util/retryable.rb +++ b/lib/vagrant/util/retryable.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module Vagrant module Util diff --git a/lib/vagrant/util/safe_chdir.rb b/lib/vagrant/util/safe_chdir.rb index 3dacda2e4d4..7314ee7bde8 100644 --- a/lib/vagrant/util/safe_chdir.rb +++ b/lib/vagrant/util/safe_chdir.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'thread' +Vagrant.require 'thread' module Vagrant module Util diff --git a/lib/vagrant/util/ssh.rb b/lib/vagrant/util/ssh.rb index 89ec5f5b614..8f3b74e7e92 100644 --- a/lib/vagrant/util/ssh.rb +++ b/lib/vagrant/util/ssh.rb @@ -1,16 +1,16 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" -require 'childprocess' +Vagrant.require 'childprocess' -require "vagrant/util/file_mode" -require "vagrant/util/platform" -require "vagrant/util/safe_exec" -require "vagrant/util/safe_puts" -require "vagrant/util/subprocess" -require "vagrant/util/which" +Vagrant.require "vagrant/util/file_mode" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/safe_exec" +Vagrant.require "vagrant/util/safe_puts" +Vagrant.require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/which" module Vagrant module Util diff --git a/lib/vagrant/util/subprocess.rb b/lib/vagrant/util/subprocess.rb index a07e26e66ff..19c56248f9a 100644 --- a/lib/vagrant/util/subprocess.rb +++ b/lib/vagrant/util/subprocess.rb @@ -1,15 +1,15 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'thread' +Vagrant.require 'thread' -require 'childprocess' -require 'log4r' +Vagrant.require 'childprocess' +Vagrant.require 'log4r' -require 'vagrant/util/io' -require 'vagrant/util/platform' -require 'vagrant/util/safe_chdir' -require 'vagrant/util/which' +Vagrant.require 'vagrant/util/io' +Vagrant.require 'vagrant/util/platform' +Vagrant.require 'vagrant/util/safe_chdir' +Vagrant.require 'vagrant/util/which' module Vagrant module Util diff --git a/lib/vagrant/util/template_renderer.rb b/lib/vagrant/util/template_renderer.rb index 272e9eff667..17d7a3aba67 100644 --- a/lib/vagrant/util/template_renderer.rb +++ b/lib/vagrant/util/template_renderer.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'ostruct' -require "pathname" +Vagrant.require 'ostruct' +Vagrant.require "pathname" -require 'erubi' +Vagrant.require 'erubi' module Vagrant module Util diff --git a/lib/vagrant/util/uploader.rb b/lib/vagrant/util/uploader.rb index 8e6632546de..804f391b870 100644 --- a/lib/vagrant/util/uploader.rb +++ b/lib/vagrant/util/uploader.rb @@ -1,13 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "uri" +Vagrant.require "uri" -require "log4r" -require "vagrant/util/busy" -require "vagrant/util/platform" -require "vagrant/util/subprocess" -require "vagrant/util/curl_helper" +Vagrant.require "log4r" +Vagrant.require "vagrant/util/busy" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/curl_helper" module Vagrant module Util diff --git a/lib/vagrant/util/which.rb b/lib/vagrant/util/which.rb index e84a91abb9a..cce735f56bd 100644 --- a/lib/vagrant/util/which.rb +++ b/lib/vagrant/util/which.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/util/platform" +Vagrant.require "vagrant/util/platform" module Vagrant module Util diff --git a/lib/vagrant/util/windows_path.rb b/lib/vagrant/util/windows_path.rb index bbafbdc592e..13df069c45e 100644 --- a/lib/vagrant/util/windows_path.rb +++ b/lib/vagrant/util/windows_path.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fiddle/import" +Vagrant.require "fiddle/import" module Vagrant module Util diff --git a/lib/vagrant/vagrantfile.rb b/lib/vagrant/vagrantfile.rb index d663653c6eb..0ee3b46ecba 100644 --- a/lib/vagrant/vagrantfile.rb +++ b/lib/vagrant/vagrantfile.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/util/template_renderer" -require "log4r" +Vagrant.require "vagrant/util/template_renderer" +Vagrant.require "log4r" module Vagrant # This class provides a way to load and access the contents diff --git a/plugins/commands/autocomplete/command/install.rb b/plugins/commands/autocomplete/command/install.rb index df76686fe67..b3caf0a5d53 100644 --- a/plugins/commands/autocomplete/command/install.rb +++ b/plugins/commands/autocomplete/command/install.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require 'vagrant/util/install_cli_autocomplete' diff --git a/plugins/commands/autocomplete/command/root.rb b/plugins/commands/autocomplete/command/root.rb index 0b9e4a87e84..7bc63e37b57 100644 --- a/plugins/commands/autocomplete/command/root.rb +++ b/plugins/commands/autocomplete/command/root.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "optparse" +Vagrant.require "optparse" require 'vagrant/util/install_cli_autocomplete' module VagrantPlugins diff --git a/plugins/commands/box/command/add.rb b/plugins/commands/box/command/add.rb index 9d33b27c6a3..c54118477b7 100644 --- a/plugins/commands/box/command/add.rb +++ b/plugins/commands/box/command/add.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative 'download_mixins' diff --git a/plugins/commands/box/command/list.rb b/plugins/commands/box/command/list.rb index d55c138b643..47e41b362c7 100644 --- a/plugins/commands/box/command/list.rb +++ b/plugins/commands/box/command/list.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandBox diff --git a/plugins/commands/box/command/outdated.rb b/plugins/commands/box/command/outdated.rb index 7bfa076909b..e7dab0ad4e2 100644 --- a/plugins/commands/box/command/outdated.rb +++ b/plugins/commands/box/command/outdated.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative 'download_mixins' diff --git a/plugins/commands/box/command/prune.rb b/plugins/commands/box/command/prune.rb index bee29993e0b..a456e6305f4 100644 --- a/plugins/commands/box/command/prune.rb +++ b/plugins/commands/box/command/prune.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandBox diff --git a/plugins/commands/box/command/remove.rb b/plugins/commands/box/command/remove.rb index 9a8b88aed61..45f9f05911d 100644 --- a/plugins/commands/box/command/remove.rb +++ b/plugins/commands/box/command/remove.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandBox diff --git a/plugins/commands/box/command/repackage.rb b/plugins/commands/box/command/repackage.rb index d7de9a47877..193b8189a9a 100644 --- a/plugins/commands/box/command/repackage.rb +++ b/plugins/commands/box/command/repackage.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" -require 'optparse' -require "pathname" +Vagrant.require "fileutils" +Vagrant.require 'optparse' +Vagrant.require "pathname" module VagrantPlugins module CommandBox diff --git a/plugins/commands/box/command/root.rb b/plugins/commands/box/command/root.rb index 7a62ede17c9..f0a0db3d2ba 100644 --- a/plugins/commands/box/command/root.rb +++ b/plugins/commands/box/command/root.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandBox diff --git a/plugins/commands/box/command/update.rb b/plugins/commands/box/command/update.rb index 34312cc5133..1e9c10641be 100644 --- a/plugins/commands/box/command/update.rb +++ b/plugins/commands/box/command/update.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative 'download_mixins' diff --git a/plugins/commands/cap/command.rb b/plugins/commands/cap/command.rb index dac52b749f7..93c0ee12cca 100644 --- a/plugins/commands/cap/command.rb +++ b/plugins/commands/cap/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandCap diff --git a/plugins/commands/cloud/auth/login.rb b/plugins/commands/cloud/auth/login.rb index 14dbfa7d9cb..59282a5c090 100644 --- a/plugins/commands/cloud/auth/login.rb +++ b/plugins/commands/cloud/auth/login.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/auth/logout.rb b/plugins/commands/cloud/auth/logout.rb index c804148685a..2158ea54f47 100644 --- a/plugins/commands/cloud/auth/logout.rb +++ b/plugins/commands/cloud/auth/logout.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/auth/middleware/add_authentication.rb b/plugins/commands/cloud/auth/middleware/add_authentication.rb index 423c49abdb8..2a9ec134fad 100644 --- a/plugins/commands/cloud/auth/middleware/add_authentication.rb +++ b/plugins/commands/cloud/auth/middleware/add_authentication.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "cgi" -require "uri" -require "log4r" +Vagrant.require "cgi" +Vagrant.require "uri" +Vagrant.require "log4r" require Vagrant.source_root.join("plugins/commands/cloud/client/client") diff --git a/plugins/commands/cloud/auth/middleware/add_downloader_authentication.rb b/plugins/commands/cloud/auth/middleware/add_downloader_authentication.rb index ee49031930f..cdd9c8e33ee 100644 --- a/plugins/commands/cloud/auth/middleware/add_downloader_authentication.rb +++ b/plugins/commands/cloud/auth/middleware/add_downloader_authentication.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "cgi" -require "uri" +Vagrant.require "cgi" +Vagrant.require "uri" +Vagrant.require "vagrant/util/credential_scrubber" -require "vagrant/util/credential_scrubber" require_relative "./add_authentication" require Vagrant.source_root.join("plugins/commands/cloud/client/client") diff --git a/plugins/commands/cloud/auth/whoami.rb b/plugins/commands/cloud/auth/whoami.rb index b7e2f91112c..f5686658cd3 100644 --- a/plugins/commands/cloud/auth/whoami.rb +++ b/plugins/commands/cloud/auth/whoami.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/box/create.rb b/plugins/commands/cloud/box/create.rb index 7f92a57d05c..f1ec6379e67 100644 --- a/plugins/commands/cloud/box/create.rb +++ b/plugins/commands/cloud/box/create.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/box/delete.rb b/plugins/commands/cloud/box/delete.rb index 85e04594dbe..8c9621a25f5 100644 --- a/plugins/commands/cloud/box/delete.rb +++ b/plugins/commands/cloud/box/delete.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/box/show.rb b/plugins/commands/cloud/box/show.rb index 101387ab6df..da483e45699 100644 --- a/plugins/commands/cloud/box/show.rb +++ b/plugins/commands/cloud/box/show.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/box/update.rb b/plugins/commands/cloud/box/update.rb index 84432ef4dd6..952cc43cb52 100644 --- a/plugins/commands/cloud/box/update.rb +++ b/plugins/commands/cloud/box/update.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/client/client.rb b/plugins/commands/cloud/client/client.rb index 1e7fec351e9..945700c3a77 100644 --- a/plugins/commands/cloud/client/client.rb +++ b/plugins/commands/cloud/client/client.rb @@ -1,9 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant_cloud" -require "vagrant/util/downloader" -require "vagrant/util/presence" +Vagrant.require "vagrant_cloud" +Vagrant.require "vagrant/util/downloader" +Vagrant.require "vagrant/util/presence" + require Vagrant.source_root.join("plugins/commands/cloud/errors") module VagrantPlugins diff --git a/plugins/commands/cloud/list.rb b/plugins/commands/cloud/list.rb index 2ec2b37fcba..a9dd7e44ae3 100644 --- a/plugins/commands/cloud/list.rb +++ b/plugins/commands/cloud/list.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/plugin.rb b/plugins/commands/cloud/plugin.rb index b09a0388a69..d0d243582bb 100644 --- a/plugins/commands/cloud/plugin.rb +++ b/plugins/commands/cloud/plugin.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant" -require 'vagrant_cloud' +Vagrant.require 'vagrant_cloud' + require Vagrant.source_root.join("plugins/commands/cloud/util") require Vagrant.source_root.join("plugins/commands/cloud/client/client") diff --git a/plugins/commands/cloud/provider/create.rb b/plugins/commands/cloud/provider/create.rb index 30c55c7d610..8606953679a 100644 --- a/plugins/commands/cloud/provider/create.rb +++ b/plugins/commands/cloud/provider/create.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/provider/delete.rb b/plugins/commands/cloud/provider/delete.rb index f80ebff32b3..fc09a739ec8 100644 --- a/plugins/commands/cloud/provider/delete.rb +++ b/plugins/commands/cloud/provider/delete.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/provider/update.rb b/plugins/commands/cloud/provider/update.rb index 22bb6b75bd7..81d39e7840f 100644 --- a/plugins/commands/cloud/provider/update.rb +++ b/plugins/commands/cloud/provider/update.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/provider/upload.rb b/plugins/commands/cloud/provider/upload.rb index 47c9f3bbebd..bf936a5e360 100644 --- a/plugins/commands/cloud/provider/upload.rb +++ b/plugins/commands/cloud/provider/upload.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' -require "vagrant/util/uploader" +Vagrant.require 'optparse' +Vagrant.require "vagrant/util/uploader" module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/publish.rb b/plugins/commands/cloud/publish.rb index a8e9c71b651..d56570a8b02 100644 --- a/plugins/commands/cloud/publish.rb +++ b/plugins/commands/cloud/publish.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' -require "vagrant/util/uploader" +Vagrant.require 'optparse' +Vagrant.require "vagrant/util/uploader" module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/search.rb b/plugins/commands/cloud/search.rb index a18793b2b12..8cba5f72053 100644 --- a/plugins/commands/cloud/search.rb +++ b/plugins/commands/cloud/search.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/version/release.rb b/plugins/commands/cloud/version/release.rb index c04a14f5f2b..9a204f85b63 100644 --- a/plugins/commands/cloud/version/release.rb +++ b/plugins/commands/cloud/version/release.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/version/revoke.rb b/plugins/commands/cloud/version/revoke.rb index dfdaaa21e3f..96bb6b54846 100644 --- a/plugins/commands/cloud/version/revoke.rb +++ b/plugins/commands/cloud/version/revoke.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/cloud/version/update.rb b/plugins/commands/cloud/version/update.rb index 380ba7498f0..6e2a8ce37ab 100644 --- a/plugins/commands/cloud/version/update.rb +++ b/plugins/commands/cloud/version/update.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CloudCommand diff --git a/plugins/commands/global-status/command.rb b/plugins/commands/global-status/command.rb index bd0e15152af..d8fdc5c6f28 100644 --- a/plugins/commands/global-status/command.rb +++ b/plugins/commands/global-status/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandGlobalStatus diff --git a/plugins/commands/halt/command.rb b/plugins/commands/halt/command.rb index 9094602dea0..5117c7ee35d 100644 --- a/plugins/commands/halt/command.rb +++ b/plugins/commands/halt/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandHalt diff --git a/plugins/commands/help/command.rb b/plugins/commands/help/command.rb index 23414e2c050..aba3a96771d 100644 --- a/plugins/commands/help/command.rb +++ b/plugins/commands/help/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandHelp diff --git a/plugins/commands/init/command.rb b/plugins/commands/init/command.rb index 45dacdcfec4..2e50cbb57b4 100644 --- a/plugins/commands/init/command.rb +++ b/plugins/commands/init/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require 'vagrant/util/template_renderer' diff --git a/plugins/commands/list-commands/command.rb b/plugins/commands/list-commands/command.rb index d2b9e10d917..3e220264864 100644 --- a/plugins/commands/list-commands/command.rb +++ b/plugins/commands/list-commands/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "optparse" +Vagrant.require "optparse" module VagrantPlugins module CommandListCommands diff --git a/plugins/commands/package/command.rb b/plugins/commands/package/command.rb index fd0c92ed6e0..3ce62da181d 100644 --- a/plugins/commands/package/command.rb +++ b/plugins/commands/package/command.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' -require 'securerandom' +Vagrant.require 'optparse' +Vagrant.require 'securerandom' module VagrantPlugins module CommandPackage diff --git a/plugins/commands/plugin/action.rb b/plugins/commands/plugin/action.rb index 9a9b964a0d8..10daeb32cdb 100644 --- a/plugins/commands/plugin/action.rb +++ b/plugins/commands/plugin/action.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" +Vagrant.require "pathname" -require "vagrant/action/builder" +Vagrant.require "vagrant/action/builder" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/action/expunge_plugins.rb b/plugins/commands/plugin/action/expunge_plugins.rb index 956885f253e..6018809bd3b 100644 --- a/plugins/commands/plugin/action/expunge_plugins.rb +++ b/plugins/commands/plugin/action/expunge_plugins.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/plugin/manager" +Vagrant.require "vagrant/plugin/manager" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/action/install_gem.rb b/plugins/commands/plugin/action/install_gem.rb index 2982055680c..45766cd4368 100644 --- a/plugins/commands/plugin/action/install_gem.rb +++ b/plugins/commands/plugin/action/install_gem.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "vagrant/plugin/manager" -require "vagrant/util/platform" +Vagrant.require "log4r" +Vagrant.require "vagrant/plugin/manager" +Vagrant.require "vagrant/util/platform" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/action/license_plugin.rb b/plugins/commands/plugin/action/license_plugin.rb index 0fb605db1fa..11f33a2b0c5 100644 --- a/plugins/commands/plugin/action/license_plugin.rb +++ b/plugins/commands/plugin/action/license_plugin.rb @@ -1,12 +1,12 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" -require "pathname" -require "rubygems" -require "set" +Vagrant.require "fileutils" +Vagrant.require "pathname" +Vagrant.require "rubygems" +Vagrant.require "set" -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/action/list_plugins.rb b/plugins/commands/plugin/action/list_plugins.rb index c6471626a9f..c2a3560c091 100644 --- a/plugins/commands/plugin/action/list_plugins.rb +++ b/plugins/commands/plugin/action/list_plugins.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/plugin/manager" +Vagrant.require "vagrant/plugin/manager" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/action/plugin_exists_check.rb b/plugins/commands/plugin/action/plugin_exists_check.rb index affd68f92c2..7c4302d6167 100644 --- a/plugins/commands/plugin/action/plugin_exists_check.rb +++ b/plugins/commands/plugin/action/plugin_exists_check.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/plugin/manager" +Vagrant.require "vagrant/plugin/manager" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/action/repair_plugins.rb b/plugins/commands/plugin/action/repair_plugins.rb index 713641f4204..667da4d8178 100644 --- a/plugins/commands/plugin/action/repair_plugins.rb +++ b/plugins/commands/plugin/action/repair_plugins.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/plugin/manager" +Vagrant.require "vagrant/plugin/manager" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/action/update_gems.rb b/plugins/commands/plugin/action/update_gems.rb index 14109043669..0bab71f2ff8 100644 --- a/plugins/commands/plugin/action/update_gems.rb +++ b/plugins/commands/plugin/action/update_gems.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/plugin/manager" +Vagrant.require "vagrant/plugin/manager" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/command/base.rb b/plugins/commands/plugin/command/base.rb index 5ca7ec37dde..27ba1d6a63e 100644 --- a/plugins/commands/plugin/command/base.rb +++ b/plugins/commands/plugin/command/base.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/plugin/state_file" +Vagrant.require "vagrant/plugin/state_file" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/command/expunge.rb b/plugins/commands/plugin/command/expunge.rb index 41fac5c8f97..7cb009efe15 100644 --- a/plugins/commands/plugin/command/expunge.rb +++ b/plugins/commands/plugin/command/expunge.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative "base" diff --git a/plugins/commands/plugin/command/install.rb b/plugins/commands/plugin/command/install.rb index 0a80d270dbe..4ced60228ec 100644 --- a/plugins/commands/plugin/command/install.rb +++ b/plugins/commands/plugin/command/install.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative "base" require_relative "mixin_install_opts" diff --git a/plugins/commands/plugin/command/license.rb b/plugins/commands/plugin/command/license.rb index b838934b4a2..0bf782ae385 100644 --- a/plugins/commands/plugin/command/license.rb +++ b/plugins/commands/plugin/command/license.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative "base" diff --git a/plugins/commands/plugin/command/list.rb b/plugins/commands/plugin/command/list.rb index fab8a479f75..8020b922fb1 100644 --- a/plugins/commands/plugin/command/list.rb +++ b/plugins/commands/plugin/command/list.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative "base" diff --git a/plugins/commands/plugin/command/repair.rb b/plugins/commands/plugin/command/repair.rb index 8ed97674940..7762d16a322 100644 --- a/plugins/commands/plugin/command/repair.rb +++ b/plugins/commands/plugin/command/repair.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative "base" diff --git a/plugins/commands/plugin/command/root.rb b/plugins/commands/plugin/command/root.rb index ead0fc33597..fae441f4fd2 100644 --- a/plugins/commands/plugin/command/root.rb +++ b/plugins/commands/plugin/command/root.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/plugin/command/uninstall.rb b/plugins/commands/plugin/command/uninstall.rb index e5ae52963c2..d9bba6b2903 100644 --- a/plugins/commands/plugin/command/uninstall.rb +++ b/plugins/commands/plugin/command/uninstall.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative "base" diff --git a/plugins/commands/plugin/command/update.rb b/plugins/commands/plugin/command/update.rb index 2a472192d84..ac48177b5fd 100644 --- a/plugins/commands/plugin/command/update.rb +++ b/plugins/commands/plugin/command/update.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require_relative "base" require_relative "mixin_install_opts" diff --git a/plugins/commands/plugin/gem_helper.rb b/plugins/commands/plugin/gem_helper.rb index 30e7598d3c1..e66ee5a5a1e 100644 --- a/plugins/commands/plugin/gem_helper.rb +++ b/plugins/commands/plugin/gem_helper.rb @@ -1,11 +1,11 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "rubygems" -require "rubygems/config_file" -require "rubygems/gem_runner" +Vagrant.require "rubygems" +Vagrant.require "rubygems/config_file" +Vagrant.require "rubygems/gem_runner" -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module CommandPlugin diff --git a/plugins/commands/port/command.rb b/plugins/commands/port/command.rb index df36c82f655..d0411bfebb1 100644 --- a/plugins/commands/port/command.rb +++ b/plugins/commands/port/command.rb @@ -3,7 +3,7 @@ require "vagrant/util/presence" -require "optparse" +Vagrant.require "optparse" module VagrantPlugins module CommandPort diff --git a/plugins/commands/powershell/command.rb b/plugins/commands/powershell/command.rb index c6e366656a4..dd13965c605 100644 --- a/plugins/commands/powershell/command.rb +++ b/plugins/commands/powershell/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "optparse" +Vagrant.require "optparse" require "vagrant/util/powershell" require_relative "../../communicators/winrm/helper" diff --git a/plugins/commands/provider/command.rb b/plugins/commands/provider/command.rb index ab85295a68a..3202bccb76e 100644 --- a/plugins/commands/provider/command.rb +++ b/plugins/commands/provider/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandProvider diff --git a/plugins/commands/provision/command.rb b/plugins/commands/provision/command.rb index 8875f611832..41156bbdb86 100644 --- a/plugins/commands/provision/command.rb +++ b/plugins/commands/provision/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandProvision diff --git a/plugins/commands/push/command.rb b/plugins/commands/push/command.rb index 35592261493..801a987fd88 100644 --- a/plugins/commands/push/command.rb +++ b/plugins/commands/push/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandPush diff --git a/plugins/commands/rdp/command.rb b/plugins/commands/rdp/command.rb index 5d7af813d1e..551fda27d90 100644 --- a/plugins/commands/rdp/command.rb +++ b/plugins/commands/rdp/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "optparse" +Vagrant.require "optparse" module VagrantPlugins module CommandRDP diff --git a/plugins/commands/reload/command.rb b/plugins/commands/reload/command.rb index f8bd000d717..9cb1d75832c 100644 --- a/plugins/commands/reload/command.rb +++ b/plugins/commands/reload/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require "vagrant" diff --git a/plugins/commands/resume/command.rb b/plugins/commands/resume/command.rb index 39552757a7d..9f556510cbf 100644 --- a/plugins/commands/resume/command.rb +++ b/plugins/commands/resume/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' require Vagrant.source_root.join("plugins/commands/up/start_mixins") diff --git a/plugins/commands/serve/broker.rb b/plugins/commands/serve/broker.rb index 1b9e3948236..674a6999e12 100644 --- a/plugins/commands/serve/broker.rb +++ b/plugins/commands/serve/broker.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "singleton" -require "thread" +Vagrant.require "singleton" +Vagrant.require "thread" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/client/capability_platform.rb b/plugins/commands/serve/client/capability_platform.rb index b0634821544..0c0a3496638 100644 --- a/plugins/commands/serve/client/capability_platform.rb +++ b/plugins/commands/serve/client/capability_platform.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "google/protobuf/well_known_types" +Vagrant.require "google/protobuf/well_known_types" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/client/guest.rb b/plugins/commands/serve/client/guest.rb index 4da5fd29bf2..f57d52f2f5c 100644 --- a/plugins/commands/serve/client/guest.rb +++ b/plugins/commands/serve/client/guest.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "google/protobuf/well_known_types" +Vagrant.require "google/protobuf/well_known_types" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/client/target.rb b/plugins/commands/serve/client/target.rb index 3656c25cc47..a4a16c942a1 100644 --- a/plugins/commands/serve/client/target.rb +++ b/plugins/commands/serve/client/target.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "time" +Vagrant.require "time" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/client/vagrantfile.rb b/plugins/commands/serve/client/vagrantfile.rb index 0c9e0987ea7..0ed18c91c01 100644 --- a/plugins/commands/serve/client/vagrantfile.rb +++ b/plugins/commands/serve/client/vagrantfile.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'ostruct' +Vagrant.require 'ostruct' module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/command.rb b/plugins/commands/serve/command.rb index fe9930fc89d..b4d602f18f6 100644 --- a/plugins/commands/serve/command.rb +++ b/plugins/commands/serve/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "optparse" +Vagrant.require "optparse" module VagrantPlugins module CommandServe @@ -25,9 +25,9 @@ class << self # the command is actually executed. def load_dependencies! return if @dependencies_loaded - require 'grpc' - require 'grpc/health/checker' - require 'grpc/health/v1/health_services_pb' + Vagrant.require 'grpc' + Vagrant.require 'grpc/health/checker' + Vagrant.require 'grpc/health/v1/health_services_pb' # Add conversion patches require Vagrant.source_root.join("plugins/commands/serve/util/direct_conversions.rb").to_s diff --git a/plugins/commands/serve/mappers.rb b/plugins/commands/serve/mappers.rb index fb0122b4dee..b4dacaf869e 100644 --- a/plugins/commands/serve/mappers.rb +++ b/plugins/commands/serve/mappers.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/sha2" -require "google/protobuf/wrappers_pb" -require "google/protobuf/well_known_types" +Vagrant.require "digest/sha2" +Vagrant.require "google/protobuf/wrappers_pb" +Vagrant.require "google/protobuf/well_known_types" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/mappers/direct.rb b/plugins/commands/serve/mappers/direct.rb index e43cfaceb2f..c0124198e02 100644 --- a/plugins/commands/serve/mappers/direct.rb +++ b/plugins/commands/serve/mappers/direct.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pp" -require "google/protobuf/well_known_types" -require "google/protobuf/wrappers_pb" +Vagrant.require "pp" +Vagrant.require "google/protobuf/well_known_types" +Vagrant.require "google/protobuf/wrappers_pb" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/mappers/internal/graph.rb b/plugins/commands/serve/mappers/internal/graph.rb index af41c736142..9b0b6593dbd 100644 --- a/plugins/commands/serve/mappers/internal/graph.rb +++ b/plugins/commands/serve/mappers/internal/graph.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "rgl/adjacency" -require "rgl/traversal" -require "rgl/dijkstra" -require "rgl/topsort" +Vagrant.require "rgl/adjacency" +Vagrant.require "rgl/traversal" +Vagrant.require "rgl/dijkstra" +Vagrant.require "rgl/topsort" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/mappers/known_types.rb b/plugins/commands/serve/mappers/known_types.rb index 9167b027760..cf7b3f60817 100644 --- a/plugins/commands/serve/mappers/known_types.rb +++ b/plugins/commands/serve/mappers/known_types.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "google/protobuf/well_known_types" +Vagrant.require "google/protobuf/well_known_types" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/mappers/proc.rb b/plugins/commands/serve/mappers/proc.rb index 28332e35b07..e248dc9b90a 100644 --- a/plugins/commands/serve/mappers/proc.rb +++ b/plugins/commands/serve/mappers/proc.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "singleton" +Vagrant.require "singleton" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/mappers/wrappers.rb b/plugins/commands/serve/mappers/wrappers.rb index 2bb73322a34..06652f65e2a 100644 --- a/plugins/commands/serve/mappers/wrappers.rb +++ b/plugins/commands/serve/mappers/wrappers.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "google/protobuf/wrappers_pb" +Vagrant.require "google/protobuf/wrappers_pb" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/service.rb b/plugins/commands/serve/service.rb index 2a9b2465d2b..892d39019ca 100644 --- a/plugins/commands/serve/service.rb +++ b/plugins/commands/serve/service.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "ostruct" +Vagrant.require "ostruct" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/service/capability_platform_service.rb b/plugins/commands/serve/service/capability_platform_service.rb index 2531b91dc07..7f5615254fe 100644 --- a/plugins/commands/serve/service/capability_platform_service.rb +++ b/plugins/commands/serve/service/capability_platform_service.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "google/protobuf/well_known_types" +Vagrant.require "google/protobuf/well_known_types" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/service/command_service.rb b/plugins/commands/serve/service/command_service.rb index 06f61450537..a56cbe82752 100644 --- a/plugins/commands/serve/service/command_service.rb +++ b/plugins/commands/serve/service/command_service.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'google/protobuf/well_known_types' +Vagrant.require 'google/protobuf/well_known_types' module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/service/communicator_service.rb b/plugins/commands/serve/service/communicator_service.rb index f87e233bbee..f133c7e9716 100644 --- a/plugins/commands/serve/service/communicator_service.rb +++ b/plugins/commands/serve/service/communicator_service.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "google/protobuf/well_known_types" +Vagrant.require "google/protobuf/well_known_types" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/service/guest_service.rb b/plugins/commands/serve/service/guest_service.rb index d157c3c1213..3b7eb7f7a6e 100644 --- a/plugins/commands/serve/service/guest_service.rb +++ b/plugins/commands/serve/service/guest_service.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "google/protobuf/well_known_types" +Vagrant.require "google/protobuf/well_known_types" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/service/host_service.rb b/plugins/commands/serve/service/host_service.rb index 358a014cbd8..19af1181034 100644 --- a/plugins/commands/serve/service/host_service.rb +++ b/plugins/commands/serve/service/host_service.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "google/protobuf/well_known_types" +Vagrant.require "google/protobuf/well_known_types" module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/service/internal_service.rb b/plugins/commands/serve/service/internal_service.rb index 4145abb1cc8..db5bf24a7c1 100644 --- a/plugins/commands/serve/service/internal_service.rb +++ b/plugins/commands/serve/service/internal_service.rb @@ -1,13 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/plugin/v2/plugin" -require "vagrant/vagrantfile" -require "vagrant/box_collection" -require "vagrant/config" -require "pathname" +Vagrant.require "vagrant/plugin/v2/plugin" +Vagrant.require "vagrant/vagrantfile" +Vagrant.require "vagrant/box_collection" +Vagrant.require "vagrant/config" +Vagrant.require "pathname" -require 'google/protobuf/well_known_types' +Vagrant.require 'google/protobuf/well_known_types' module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/util/direct_conversions.rb b/plugins/commands/serve/util/direct_conversions.rb index 01839f3da79..e47b6d35434 100644 --- a/plugins/commands/serve/util/direct_conversions.rb +++ b/plugins/commands/serve/util/direct_conversions.rb @@ -2,10 +2,10 @@ # SPDX-License-Identifier: BUSL-1.1 # Patch things to produce proto messages -require "pathname" -require "securerandom" -require "google/protobuf/wrappers_pb" -require "google/protobuf/well_known_types" +Vagrant.require "pathname" +Vagrant.require "securerandom" +Vagrant.require "google/protobuf/wrappers_pb" +Vagrant.require "google/protobuf/well_known_types" PROTO_LOGGER = Log4r::Logger.new("vagrant::protologger") diff --git a/plugins/commands/serve/util/exception_transformer.rb b/plugins/commands/serve/util/exception_transformer.rb index 2af4d0bb731..56992539a0a 100644 --- a/plugins/commands/serve/util/exception_transformer.rb +++ b/plugins/commands/serve/util/exception_transformer.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'google/protobuf/well_known_types' -require 'google/rpc/error_details_pb' +Vagrant.require 'google/protobuf/well_known_types' +Vagrant.require 'google/rpc/error_details_pb' module VagrantPlugins module CommandServe diff --git a/plugins/commands/serve/util/usage_tracker.rb b/plugins/commands/serve/util/usage_tracker.rb index 15fc62d4afc..88dfcb0564d 100644 --- a/plugins/commands/serve/util/usage_tracker.rb +++ b/plugins/commands/serve/util/usage_tracker.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "mutex_m" +Vagrant.require "mutex_m" module VagrantPlugins module CommandServe diff --git a/plugins/commands/snapshot/command/delete.rb b/plugins/commands/snapshot/command/delete.rb index 470a906a866..dd83278c8de 100644 --- a/plugins/commands/snapshot/command/delete.rb +++ b/plugins/commands/snapshot/command/delete.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandSnapshot diff --git a/plugins/commands/snapshot/command/list.rb b/plugins/commands/snapshot/command/list.rb index 7662f5d7797..68639526db4 100644 --- a/plugins/commands/snapshot/command/list.rb +++ b/plugins/commands/snapshot/command/list.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandSnapshot diff --git a/plugins/commands/snapshot/command/pop.rb b/plugins/commands/snapshot/command/pop.rb index c0a32d31dff..7b170010d84 100644 --- a/plugins/commands/snapshot/command/pop.rb +++ b/plugins/commands/snapshot/command/pop.rb @@ -1,10 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'json' -require 'optparse' - -require 'vagrant' +Vagrant.require 'json' +Vagrant.require 'optparse' require Vagrant.source_root.join("plugins/commands/up/start_mixins") diff --git a/plugins/commands/snapshot/command/push.rb b/plugins/commands/snapshot/command/push.rb index 3b860979c4f..005a85dd78b 100644 --- a/plugins/commands/snapshot/command/push.rb +++ b/plugins/commands/snapshot/command/push.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'json' -require 'optparse' +Vagrant.require 'json' +Vagrant.require 'optparse' require_relative "push_shared" diff --git a/plugins/commands/snapshot/command/push_shared.rb b/plugins/commands/snapshot/command/push_shared.rb index c166a368556..aa080b7dd83 100644 --- a/plugins/commands/snapshot/command/push_shared.rb +++ b/plugins/commands/snapshot/command/push_shared.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'json' +Vagrant.require 'json' module VagrantPlugins module CommandSnapshot diff --git a/plugins/commands/snapshot/command/restore.rb b/plugins/commands/snapshot/command/restore.rb index d9491c85066..aac7a8514db 100644 --- a/plugins/commands/snapshot/command/restore.rb +++ b/plugins/commands/snapshot/command/restore.rb @@ -1,9 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' - -require 'vagrant' +Vagrant.require 'optparse' require Vagrant.source_root.join("plugins/commands/up/start_mixins") diff --git a/plugins/commands/snapshot/command/root.rb b/plugins/commands/snapshot/command/root.rb index a4dad2b0d96..0f8750c2181 100644 --- a/plugins/commands/snapshot/command/root.rb +++ b/plugins/commands/snapshot/command/root.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandSnapshot diff --git a/plugins/commands/snapshot/command/save.rb b/plugins/commands/snapshot/command/save.rb index 3ea4b9228d5..11f63c2ac5e 100644 --- a/plugins/commands/snapshot/command/save.rb +++ b/plugins/commands/snapshot/command/save.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandSnapshot diff --git a/plugins/commands/ssh/command.rb b/plugins/commands/ssh/command.rb index 2e13f39558f..95e227434b1 100644 --- a/plugins/commands/ssh/command.rb +++ b/plugins/commands/ssh/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandSSH diff --git a/plugins/commands/ssh_config/command.rb b/plugins/commands/ssh_config/command.rb index f00b2bed6fa..18380061243 100644 --- a/plugins/commands/ssh_config/command.rb +++ b/plugins/commands/ssh_config/command.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' -require "vagrant/util/safe_puts" -require "vagrant/util/platform" +Vagrant.require "vagrant/util/safe_puts" +Vagrant.require "vagrant/util/platform" module VagrantPlugins module CommandSSHConfig diff --git a/plugins/commands/status/command.rb b/plugins/commands/status/command.rb index 9c4dc623007..b09495b58c5 100644 --- a/plugins/commands/status/command.rb +++ b/plugins/commands/status/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandStatus diff --git a/plugins/commands/suspend/command.rb b/plugins/commands/suspend/command.rb index 114c8017278..727bdd8b333 100644 --- a/plugins/commands/suspend/command.rb +++ b/plugins/commands/suspend/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandSuspend diff --git a/plugins/commands/up/command.rb b/plugins/commands/up/command.rb index 1dba4515ed0..974b059af96 100644 --- a/plugins/commands/up/command.rb +++ b/plugins/commands/up/command.rb @@ -1,10 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' -require 'set' - -require "vagrant" +Vagrant.require 'optparse' +Vagrant.require 'set' require File.expand_path("../start_mixins", __FILE__) diff --git a/plugins/commands/up/start_mixins.rb b/plugins/commands/up/start_mixins.rb index c0101d22afc..f7c04fabfdd 100644 --- a/plugins/commands/up/start_mixins.rb +++ b/plugins/commands/up/start_mixins.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "set" +Vagrant.require "set" module VagrantPlugins module CommandUp diff --git a/plugins/commands/upload/command.rb b/plugins/commands/upload/command.rb index 2276aa3a911..5eca4e612d7 100644 --- a/plugins/commands/upload/command.rb +++ b/plugins/commands/upload/command.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' -require "rubygems/package" +Vagrant.require 'optparse' +Vagrant.require "rubygems/package" module VagrantPlugins module CommandUpload diff --git a/plugins/commands/validate/command.rb b/plugins/commands/validate/command.rb index e19b3bc67bb..f6f78459536 100644 --- a/plugins/commands/validate/command.rb +++ b/plugins/commands/validate/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' module VagrantPlugins module CommandValidate @@ -59,7 +59,7 @@ def execute # # return [String] tmp_data_dir - Temporary dir used to store guest metadata during validation def mockup_providers! - require 'log4r' + Vagrant.require 'log4r' logger = Log4r::Logger.new("vagrant::validate") logger.debug("Overriding all registered provider classes for validate") diff --git a/plugins/commands/version/command.rb b/plugins/commands/version/command.rb index f931bd16232..525e777a6c1 100644 --- a/plugins/commands/version/command.rb +++ b/plugins/commands/version/command.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "optparse" +Vagrant.require "optparse" module VagrantPlugins module CommandVersion diff --git a/plugins/commands/winrm/command.rb b/plugins/commands/winrm/command.rb index ac33709a783..73af85a47f7 100644 --- a/plugins/commands/winrm/command.rb +++ b/plugins/commands/winrm/command.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' - -require "vagrant/util/safe_puts" +Vagrant.require 'optparse' +Vagrant.require "vagrant/util/safe_puts" module VagrantPlugins module CommandWinRM diff --git a/plugins/commands/winrm_config/command.rb b/plugins/commands/winrm_config/command.rb index 613978ac43f..8c6a78e1e1d 100644 --- a/plugins/commands/winrm_config/command.rb +++ b/plugins/commands/winrm_config/command.rb @@ -1,7 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' + require "vagrant/util/safe_puts" require_relative "../../communicators/winrm/helper" diff --git a/plugins/communicators/ssh/communicator.rb b/plugins/communicators/ssh/communicator.rb index db5403b8e61..8dfa9ccfcd3 100644 --- a/plugins/communicators/ssh/communicator.rb +++ b/plugins/communicators/ssh/communicator.rb @@ -1,23 +1,23 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'etc' -require 'logger' -require 'pathname' -require 'stringio' -require 'thread' -require 'timeout' - -require 'log4r' -require 'net/ssh' -require 'net/ssh/proxy/command' -require 'net/scp' - -require 'vagrant/util/ansi_escape_code_remover' -require 'vagrant/util/file_mode' -require 'vagrant/util/keypair' -require 'vagrant/util/platform' -require 'vagrant/util/retryable' +Vagrant.require 'etc' +Vagrant.require 'logger' +Vagrant.require 'pathname' +Vagrant.require 'stringio' +Vagrant.require 'thread' +Vagrant.require 'timeout' + +Vagrant.require 'log4r' +Vagrant.require 'net/ssh' +Vagrant.require 'net/ssh/proxy/command' +Vagrant.require 'net/scp' + +Vagrant.require 'vagrant/util/ansi_escape_code_remover' +Vagrant.require 'vagrant/util/file_mode' +Vagrant.require 'vagrant/util/keypair' +Vagrant.require 'vagrant/util/platform' +Vagrant.require 'vagrant/util/retryable' module VagrantPlugins module CommunicatorSSH diff --git a/plugins/communicators/winrm/command_filters/mkdir.rb b/plugins/communicators/winrm/command_filters/mkdir.rb index 09f85a39c8e..b53a3c48149 100644 --- a/plugins/communicators/winrm/command_filters/mkdir.rb +++ b/plugins/communicators/winrm/command_filters/mkdir.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "shellwords" +Vagrant.require "shellwords" module VagrantPlugins module CommunicatorWinRM diff --git a/plugins/communicators/winrm/command_filters/rm.rb b/plugins/communicators/winrm/command_filters/rm.rb index 5c859cc7c6b..d68b542e73d 100644 --- a/plugins/communicators/winrm/command_filters/rm.rb +++ b/plugins/communicators/winrm/command_filters/rm.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "shellwords" +Vagrant.require "shellwords" module VagrantPlugins module CommunicatorWinRM diff --git a/plugins/communicators/winrm/command_filters/test.rb b/plugins/communicators/winrm/command_filters/test.rb index 4aedecb9f87..563b63a47db 100644 --- a/plugins/communicators/winrm/command_filters/test.rb +++ b/plugins/communicators/winrm/command_filters/test.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "shellwords" +Vagrant.require "shellwords" module VagrantPlugins module CommunicatorWinRM diff --git a/plugins/communicators/winrm/command_filters/which.rb b/plugins/communicators/winrm/command_filters/which.rb index 0be0df326c7..f9c75715699 100644 --- a/plugins/communicators/winrm/command_filters/which.rb +++ b/plugins/communicators/winrm/command_filters/which.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "shellwords" +Vagrant.require "shellwords" module VagrantPlugins module CommunicatorWinRM diff --git a/plugins/communicators/winrm/communicator.rb b/plugins/communicators/winrm/communicator.rb index 85c055afa41..5655eecd07a 100644 --- a/plugins/communicators/winrm/communicator.rb +++ b/plugins/communicators/winrm/communicator.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "tempfile" -require "timeout" +Vagrant.require "log4r" +Vagrant.require "tempfile" +Vagrant.require "timeout" require_relative "helper" require_relative "shell" diff --git a/plugins/communicators/winrm/shell.rb b/plugins/communicators/winrm/shell.rb index 1cf2d325c5b..91d452e88b9 100644 --- a/plugins/communicators/winrm/shell.rb +++ b/plugins/communicators/winrm/shell.rb @@ -1,19 +1,19 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "timeout" +Vagrant.require "timeout" -require "log4r" +Vagrant.require "log4r" -require "vagrant/util/retryable" -require "vagrant/util/silence_warnings" +Vagrant.require "vagrant/util/retryable" +Vagrant.require "vagrant/util/silence_warnings" Vagrant::Util::SilenceWarnings.silence! do - require "winrm" + Vagrant.require "winrm" end -require "winrm-elevated" -require "winrm-fs" +Vagrant.require "winrm-elevated" +Vagrant.require "winrm-fs" module VagrantPlugins module CommunicatorWinRM diff --git a/plugins/communicators/winssh/communicator.rb b/plugins/communicators/winssh/communicator.rb index 528a5bb51d4..914c8713a11 100644 --- a/plugins/communicators/winssh/communicator.rb +++ b/plugins/communicators/winssh/communicator.rb @@ -3,7 +3,7 @@ require File.expand_path("../../ssh/communicator", __FILE__) -require 'net/sftp' +Vagrant.require "net/sftp" module VagrantPlugins module CommunicatorWinSSH diff --git a/plugins/guests/alpine/cap/configure_networks.rb b/plugins/guests/alpine/cap/configure_networks.rb index 9e38ae79337..2203134d3b8 100644 --- a/plugins/guests/alpine/cap/configure_networks.rb +++ b/plugins/guests/alpine/cap/configure_networks.rb @@ -7,10 +7,10 @@ # # FIXME: address disabled warnings # -require 'set' -require 'tempfile' -require 'pathname' -require 'vagrant/util/template_renderer' +Vagrant.require 'set' +Vagrant.require 'tempfile' +Vagrant.require 'pathname' +Vagrant.require 'vagrant/util/template_renderer' module VagrantPlugins module GuestAlpine diff --git a/plugins/guests/alt/cap/configure_networks.rb b/plugins/guests/alt/cap/configure_networks.rb index ad31ac6ea04..affa71d47e5 100644 --- a/plugins/guests/alt/cap/configure_networks.rb +++ b/plugins/guests/alt/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/arch/cap/configure_networks.rb b/plugins/guests/arch/cap/configure_networks.rb index 52ed72f5c43..81a431b8d85 100644 --- a/plugins/guests/arch/cap/configure_networks.rb +++ b/plugins/guests/arch/cap/configure_networks.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "ipaddr" -require "socket" -require "tempfile" +Vagrant.require "ipaddr" +Vagrant.require "socket" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/bsd/cap/nfs.rb b/plugins/guests/bsd/cap/nfs.rb index 811f5816771..00e1a44b217 100644 --- a/plugins/guests/bsd/cap/nfs.rb +++ b/plugins/guests/bsd/cap/nfs.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "shellwords" -require "vagrant/util/retryable" +Vagrant.require "shellwords" +Vagrant.require "vagrant/util/retryable" module VagrantPlugins module GuestBSD diff --git a/plugins/guests/bsd/cap/public_key.rb b/plugins/guests/bsd/cap/public_key.rb index 875490477ef..30bd9927fe2 100644 --- a/plugins/guests/bsd/cap/public_key.rb +++ b/plugins/guests/bsd/cap/public_key.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" -require "vagrant/util/shell_quote" +Vagrant.require "vagrant/util/shell_quote" module VagrantPlugins module GuestBSD diff --git a/plugins/guests/coreos/cap/change_host_name.rb b/plugins/guests/coreos/cap/change_host_name.rb index 132e691aedc..a7ab03d84dc 100644 --- a/plugins/guests/coreos/cap/change_host_name.rb +++ b/plugins/guests/coreos/cap/change_host_name.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" -require "yaml" +Vagrant.require "tempfile" +Vagrant.require "yaml" module VagrantPlugins module GuestCoreOS diff --git a/plugins/guests/darwin/cap/configure_networks.rb b/plugins/guests/darwin/cap/configure_networks.rb index 1155e01bda3..f4d46ac759a 100644 --- a/plugins/guests/darwin/cap/configure_networks.rb +++ b/plugins/guests/darwin/cap/configure_networks.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" -require "vagrant/util/template_renderer" +Vagrant.require "vagrant/util/template_renderer" module VagrantPlugins module GuestDarwin diff --git a/plugins/guests/darwin/cap/mount_smb_shared_folder.rb b/plugins/guests/darwin/cap/mount_smb_shared_folder.rb index 4cbfd24aa1a..028a9280294 100644 --- a/plugins/guests/darwin/cap/mount_smb_shared_folder.rb +++ b/plugins/guests/darwin/cap/mount_smb_shared_folder.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/util/retryable" -require "shellwords" +Vagrant.require "vagrant/util/retryable" +Vagrant.require "shellwords" module VagrantPlugins module GuestDarwin diff --git a/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb b/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb index 400289c6883..493d6c3b1b3 100644 --- a/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb +++ b/plugins/guests/darwin/cap/mount_vmware_shared_folder.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "securerandom" +Vagrant.require "securerandom" module VagrantPlugins module GuestDarwin diff --git a/plugins/guests/debian/cap/change_host_name.rb b/plugins/guests/debian/cap/change_host_name.rb index 00dae555982..a67cf830375 100644 --- a/plugins/guests/debian/cap/change_host_name.rb +++ b/plugins/guests/debian/cap/change_host_name.rb @@ -1,9 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require 'vagrant/util/guest_hosts' -require 'vagrant/util/guest_inspection' +Vagrant.require "log4r" +Vagrant.require 'vagrant/util/guest_hosts' +Vagrant.require 'vagrant/util/guest_inspection' + require_relative "../../linux/cap/network_interfaces" module VagrantPlugins diff --git a/plugins/guests/debian/cap/configure_networks.rb b/plugins/guests/debian/cap/configure_networks.rb index ce18ac13af3..eb9996ee79c 100644 --- a/plugins/guests/debian/cap/configure_networks.rb +++ b/plugins/guests/debian/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/esxi/cap/public_key.rb b/plugins/guests/esxi/cap/public_key.rb index 23b94197ad2..08fdb23b54c 100644 --- a/plugins/guests/esxi/cap/public_key.rb +++ b/plugins/guests/esxi/cap/public_key.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" -require "vagrant/util/shell_quote" +Vagrant.require "vagrant/util/shell_quote" module VagrantPlugins module GuestEsxi diff --git a/plugins/guests/freebsd/cap/configure_networks.rb b/plugins/guests/freebsd/cap/configure_networks.rb index 4c117805a99..393d88fb286 100644 --- a/plugins/guests/freebsd/cap/configure_networks.rb +++ b/plugins/guests/freebsd/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/funtoo/cap/configure_networks.rb b/plugins/guests/funtoo/cap/configure_networks.rb index 2980c8f4a31..0955352be39 100644 --- a/plugins/guests/funtoo/cap/configure_networks.rb +++ b/plugins/guests/funtoo/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/gentoo/cap/configure_networks.rb b/plugins/guests/gentoo/cap/configure_networks.rb index 691dde90380..8c3edac7d28 100644 --- a/plugins/guests/gentoo/cap/configure_networks.rb +++ b/plugins/guests/gentoo/cap/configure_networks.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" -require "ipaddr" +Vagrant.require "tempfile" +Vagrant.require "ipaddr" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/linux/cap/mount_smb_shared_folder.rb b/plugins/guests/linux/cap/mount_smb_shared_folder.rb index af134aab989..db4d418db20 100644 --- a/plugins/guests/linux/cap/mount_smb_shared_folder.rb +++ b/plugins/guests/linux/cap/mount_smb_shared_folder.rb @@ -1,8 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" -require "shellwords" +Vagrant.require "fileutils" +Vagrant.require "shellwords" + require_relative "../../../synced_folders/unix_mount_helpers" module VagrantPlugins diff --git a/plugins/guests/linux/cap/public_key.rb b/plugins/guests/linux/cap/public_key.rb index 0c0a6e33589..7776c0a4ef8 100644 --- a/plugins/guests/linux/cap/public_key.rb +++ b/plugins/guests/linux/cap/public_key.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" -require "vagrant/util/shell_quote" +Vagrant.require "vagrant/util/shell_quote" module VagrantPlugins module GuestLinux diff --git a/plugins/guests/linux/cap/reboot.rb b/plugins/guests/linux/cap/reboot.rb index 7e7c1d4f243..f70bc16796e 100644 --- a/plugins/guests/linux/cap/reboot.rb +++ b/plugins/guests/linux/cap/reboot.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'vagrant/util/guest_inspection' -require "log4r" +Vagrant.require 'vagrant/util/guest_inspection' +Vagrant.require "log4r" module VagrantPlugins module GuestLinux diff --git a/plugins/guests/netbsd/cap/configure_networks.rb b/plugins/guests/netbsd/cap/configure_networks.rb index 697e4915432..17fa43b5abb 100644 --- a/plugins/guests/netbsd/cap/configure_networks.rb +++ b/plugins/guests/netbsd/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/nixos/cap/change_host_name.rb b/plugins/guests/nixos/cap/change_host_name.rb index 381b373d516..4e92ad18892 100644 --- a/plugins/guests/nixos/cap/change_host_name.rb +++ b/plugins/guests/nixos/cap/change_host_name.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/nixos/cap/configure_networks.rb b/plugins/guests/nixos/cap/configure_networks.rb index c4380cd322b..4d369b0f297 100644 --- a/plugins/guests/nixos/cap/configure_networks.rb +++ b/plugins/guests/nixos/cap/configure_networks.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "ipaddr" -require "tempfile" +Vagrant.require "ipaddr" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/openbsd/cap/configure_networks.rb b/plugins/guests/openbsd/cap/configure_networks.rb index 3cbd34cde77..7d27a6d9d1b 100644 --- a/plugins/guests/openbsd/cap/configure_networks.rb +++ b/plugins/guests/openbsd/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/redhat/cap/configure_networks.rb b/plugins/guests/redhat/cap/configure_networks.rb index 0f9bb32369d..c7ac9353868 100644 --- a/plugins/guests/redhat/cap/configure_networks.rb +++ b/plugins/guests/redhat/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/slackware/cap/configure_networks.rb b/plugins/guests/slackware/cap/configure_networks.rb index c4986e8a29f..dd6d42d4830 100644 --- a/plugins/guests/slackware/cap/configure_networks.rb +++ b/plugins/guests/slackware/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/suse/cap/configure_networks.rb b/plugins/guests/suse/cap/configure_networks.rb index ac98b57bf47..cd02db0b998 100644 --- a/plugins/guests/suse/cap/configure_networks.rb +++ b/plugins/guests/suse/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/guests/tinycore/cap/configure_networks.rb b/plugins/guests/tinycore/cap/configure_networks.rb index 4a7ec93aec8..6996c7f3d80 100644 --- a/plugins/guests/tinycore/cap/configure_networks.rb +++ b/plugins/guests/tinycore/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "ipaddr" +Vagrant.require "ipaddr" module VagrantPlugins module GuestTinyCore diff --git a/plugins/guests/windows/cap/change_host_name.rb b/plugins/guests/windows/cap/change_host_name.rb index 9300ee01662..34db1a7e8d1 100644 --- a/plugins/guests/windows/cap/change_host_name.rb +++ b/plugins/guests/windows/cap/change_host_name.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module GuestWindows diff --git a/plugins/guests/windows/cap/configure_networks.rb b/plugins/guests/windows/cap/configure_networks.rb index 3c8e0c055f9..49266970532 100644 --- a/plugins/guests/windows/cap/configure_networks.rb +++ b/plugins/guests/windows/cap/configure_networks.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" require_relative "../guest_network" diff --git a/plugins/guests/windows/cap/mount_shared_folder.rb b/plugins/guests/windows/cap/mount_shared_folder.rb index df9d1caf5ab..1c6df54a2ec 100644 --- a/plugins/guests/windows/cap/mount_shared_folder.rb +++ b/plugins/guests/windows/cap/mount_shared_folder.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/util/template_renderer" -require "base64" +Vagrant.require "vagrant/util/template_renderer" +Vagrant.require "base64" module VagrantPlugins module GuestWindows diff --git a/plugins/guests/windows/cap/public_key.rb b/plugins/guests/windows/cap/public_key.rb index 0316cec7f5f..54af10ae316 100644 --- a/plugins/guests/windows/cap/public_key.rb +++ b/plugins/guests/windows/cap/public_key.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative '../../../communicators/winssh/communicator' diff --git a/plugins/guests/windows/cap/reboot.rb b/plugins/guests/windows/cap/reboot.rb index 029406c344c..3946a5a8225 100644 --- a/plugins/guests/windows/cap/reboot.rb +++ b/plugins/guests/windows/cap/reboot.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module GuestWindows diff --git a/plugins/guests/windows/guest_network.rb b/plugins/guests/windows/guest_network.rb index 75f5f8fe76f..f5c1cd1162a 100644 --- a/plugins/guests/windows/guest_network.rb +++ b/plugins/guests/windows/guest_network.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module GuestWindows diff --git a/plugins/hosts/bsd/cap/nfs.rb b/plugins/hosts/bsd/cap/nfs.rb index 60794d85d7e..5732a6c85c5 100644 --- a/plugins/hosts/bsd/cap/nfs.rb +++ b/plugins/hosts/bsd/cap/nfs.rb @@ -1,11 +1,11 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" -require "vagrant/util" -require "vagrant/util/shell_quote" -require "vagrant/util/which" +Vagrant.require "vagrant/util" +Vagrant.require "vagrant/util/shell_quote" +Vagrant.require "vagrant/util/which" module VagrantPlugins module HostBSD diff --git a/plugins/hosts/darwin/cap/configured_ip_addresses.rb b/plugins/hosts/darwin/cap/configured_ip_addresses.rb index 1c0aec830c6..b3e8ca9686b 100644 --- a/plugins/hosts/darwin/cap/configured_ip_addresses.rb +++ b/plugins/hosts/darwin/cap/configured_ip_addresses.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "socket" +Vagrant.require "socket" module VagrantPlugins module HostDarwin diff --git a/plugins/hosts/darwin/cap/fs_iso.rb b/plugins/hosts/darwin/cap/fs_iso.rb index e7aa7a5ecef..65c88afd61d 100644 --- a/plugins/hosts/darwin/cap/fs_iso.rb +++ b/plugins/hosts/darwin/cap/fs_iso.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "vagrant/util/caps" +Vagrant.require "pathname" +Vagrant.require "vagrant/util/caps" module VagrantPlugins module HostDarwin diff --git a/plugins/hosts/darwin/cap/provider_install_virtualbox.rb b/plugins/hosts/darwin/cap/provider_install_virtualbox.rb index dc8c0f7a7da..e6b5b483715 100644 --- a/plugins/hosts/darwin/cap/provider_install_virtualbox.rb +++ b/plugins/hosts/darwin/cap/provider_install_virtualbox.rb @@ -1,12 +1,12 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "tempfile" +Vagrant.require "pathname" +Vagrant.require "tempfile" -require "vagrant/util/downloader" -require "vagrant/util/file_checksum" -require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/downloader" +Vagrant.require "vagrant/util/file_checksum" +Vagrant.require "vagrant/util/subprocess" module VagrantPlugins module HostDarwin diff --git a/plugins/hosts/darwin/cap/rdp.rb b/plugins/hosts/darwin/cap/rdp.rb index 27e52693257..8fc05f310d4 100644 --- a/plugins/hosts/darwin/cap/rdp.rb +++ b/plugins/hosts/darwin/cap/rdp.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "tmpdir" +Vagrant.require "pathname" +Vagrant.require "tmpdir" -require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/subprocess" module VagrantPlugins module HostDarwin diff --git a/plugins/hosts/linux/cap/fs_iso.rb b/plugins/hosts/linux/cap/fs_iso.rb index 6c7bc63c99b..91016813f02 100644 --- a/plugins/hosts/linux/cap/fs_iso.rb +++ b/plugins/hosts/linux/cap/fs_iso.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "vagrant/util/caps" +Vagrant.require "pathname" +Vagrant.require "vagrant/util/caps" module VagrantPlugins module HostLinux diff --git a/plugins/hosts/linux/cap/nfs.rb b/plugins/hosts/linux/cap/nfs.rb index f2732c58b5b..f6845bf2d21 100644 --- a/plugins/hosts/linux/cap/nfs.rb +++ b/plugins/hosts/linux/cap/nfs.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "shellwords" -require "vagrant/util" -require "vagrant/util/shell_quote" -require "vagrant/util/retryable" +Vagrant.require "shellwords" +Vagrant.require "vagrant/util" +Vagrant.require "vagrant/util/shell_quote" +Vagrant.require "vagrant/util/retryable" module VagrantPlugins module HostLinux diff --git a/plugins/hosts/linux/cap/rdp.rb b/plugins/hosts/linux/cap/rdp.rb index 834c3c056fd..f394fc83e49 100644 --- a/plugins/hosts/linux/cap/rdp.rb +++ b/plugins/hosts/linux/cap/rdp.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "vagrant/util/which" +Vagrant.require "vagrant/util/which" module VagrantPlugins module HostLinux diff --git a/plugins/hosts/redhat/cap/nfs.rb b/plugins/hosts/redhat/cap/nfs.rb index 83e8938ce98..0f0e6d65c9e 100644 --- a/plugins/hosts/redhat/cap/nfs.rb +++ b/plugins/hosts/redhat/cap/nfs.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" +Vagrant.require "pathname" module VagrantPlugins module HostRedHat diff --git a/plugins/hosts/redhat/host.rb b/plugins/hosts/redhat/host.rb index 73a0553a6e9..bf242f50adc 100644 --- a/plugins/hosts/redhat/host.rb +++ b/plugins/hosts/redhat/host.rb @@ -1,9 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" - -require "vagrant" +Vagrant.require "pathname" module VagrantPlugins module HostRedHat diff --git a/plugins/hosts/suse/host.rb b/plugins/hosts/suse/host.rb index b69ea7a0055..040b074ca23 100644 --- a/plugins/hosts/suse/host.rb +++ b/plugins/hosts/suse/host.rb @@ -1,9 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" - -require "vagrant" +Vagrant.require "pathname" module VagrantPlugins module HostSUSE diff --git a/plugins/hosts/void/host.rb b/plugins/hosts/void/host.rb index e1343a0738f..d94074e785c 100644 --- a/plugins/hosts/void/host.rb +++ b/plugins/hosts/void/host.rb @@ -1,9 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'pathname' - -require 'vagrant' +Vagrant.require 'pathname' module VagrantPlugins module HostVoid diff --git a/plugins/hosts/windows/cap/configured_ip_addresses.rb b/plugins/hosts/windows/cap/configured_ip_addresses.rb index 664525653f5..536a3310fe6 100644 --- a/plugins/hosts/windows/cap/configured_ip_addresses.rb +++ b/plugins/hosts/windows/cap/configured_ip_addresses.rb @@ -1,13 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "tempfile" +Vagrant.require "pathname" +Vagrant.require "tempfile" -require "vagrant/util/downloader" -require "vagrant/util/file_checksum" -require "vagrant/util/powershell" -require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/downloader" +Vagrant.require "vagrant/util/file_checksum" +Vagrant.require "vagrant/util/powershell" +Vagrant.require "vagrant/util/subprocess" module VagrantPlugins module HostWindows diff --git a/plugins/hosts/windows/cap/fs_iso.rb b/plugins/hosts/windows/cap/fs_iso.rb index 24542601ab5..cf95639d315 100644 --- a/plugins/hosts/windows/cap/fs_iso.rb +++ b/plugins/hosts/windows/cap/fs_iso.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "vagrant/util/caps" +Vagrant.require "pathname" +Vagrant.require "vagrant/util/caps" module VagrantPlugins module HostWindows diff --git a/plugins/hosts/windows/cap/provider_install_virtualbox.rb b/plugins/hosts/windows/cap/provider_install_virtualbox.rb index 2f74af08421..569037b6b1d 100644 --- a/plugins/hosts/windows/cap/provider_install_virtualbox.rb +++ b/plugins/hosts/windows/cap/provider_install_virtualbox.rb @@ -1,13 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "tempfile" +Vagrant.require "pathname" +Vagrant.require "tempfile" -require "vagrant/util/downloader" -require "vagrant/util/file_checksum" -require "vagrant/util/powershell" -require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/downloader" +Vagrant.require "vagrant/util/file_checksum" +Vagrant.require "vagrant/util/powershell" +Vagrant.require "vagrant/util/subprocess" module VagrantPlugins module HostWindows diff --git a/plugins/hosts/windows/cap/ps.rb b/plugins/hosts/windows/cap/ps.rb index 41cba15d34e..79a5fec9e4a 100644 --- a/plugins/hosts/windows/cap/ps.rb +++ b/plugins/hosts/windows/cap/ps.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "tmpdir" +Vagrant.require "pathname" +Vagrant.require "tmpdir" -require "vagrant/util/safe_exec" +Vagrant.require "vagrant/util/safe_exec" module VagrantPlugins module HostWindows diff --git a/plugins/hosts/windows/cap/rdp.rb b/plugins/hosts/windows/cap/rdp.rb index 547fcb007ee..7e34ea68a8b 100644 --- a/plugins/hosts/windows/cap/rdp.rb +++ b/plugins/hosts/windows/cap/rdp.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "tmpdir" +Vagrant.require "pathname" +Vagrant.require "tmpdir" -require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/subprocess" module VagrantPlugins module HostWindows diff --git a/plugins/kernel_v2/config/cloud_init.rb b/plugins/kernel_v2/config/cloud_init.rb index 435060cd30a..bb39f2c5a47 100644 --- a/plugins/kernel_v2/config/cloud_init.rb +++ b/plugins/kernel_v2/config/cloud_init.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "securerandom" +Vagrant.require "log4r" +Vagrant.require "securerandom" module VagrantPlugins module Kernel_V2 diff --git a/plugins/kernel_v2/config/disk.rb b/plugins/kernel_v2/config/disk.rb index 8051508b69e..704c5735dd6 100644 --- a/plugins/kernel_v2/config/disk.rb +++ b/plugins/kernel_v2/config/disk.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "securerandom" +Vagrant.require "log4r" +Vagrant.require "securerandom" -require "vagrant/util/numeric" +Vagrant.require "vagrant/util/numeric" module VagrantPlugins module Kernel_V2 diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 96980d1e1bd..95877d6decc 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -1,17 +1,17 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "securerandom" -require "set" - -require "vagrant" -require "vagrant/action/builtin/mixin_synced_folders" -require "vagrant/config/v2/util" -require "vagrant/util/platform" -require "vagrant/util/presence" -require "vagrant/util/experimental" -require "vagrant/util/map_command_options" +Vagrant.require "pathname" +Vagrant.require "securerandom" +Vagrant.require "set" + +Vagrant.require "vagrant" +Vagrant.require "vagrant/action/builtin/mixin_synced_folders" +Vagrant.require "vagrant/config/v2/util" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/presence" +Vagrant.require "vagrant/util/experimental" +Vagrant.require "vagrant/util/map_command_options" require File.expand_path("../vm_provisioner", __FILE__) require File.expand_path("../vm_subvm", __FILE__) diff --git a/plugins/kernel_v2/config/vm_provisioner.rb b/plugins/kernel_v2/config/vm_provisioner.rb index 89abf8509a0..6e6464df212 100644 --- a/plugins/kernel_v2/config/vm_provisioner.rb +++ b/plugins/kernel_v2/config/vm_provisioner.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'log4r' +Vagrant.require 'log4r' module VagrantPlugins module Kernel_V2 diff --git a/plugins/kernel_v2/config/vm_trigger.rb b/plugins/kernel_v2/config/vm_trigger.rb index 2649f210aae..deb0a603f91 100644 --- a/plugins/kernel_v2/config/vm_trigger.rb +++ b/plugins/kernel_v2/config/vm_trigger.rb @@ -1,8 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "securerandom" +Vagrant.require "log4r" +Vagrant.require "securerandom" + require Vagrant.source_root.join("plugins/provisioners/shell/config") module VagrantPlugins diff --git a/plugins/providers/docker/action/build.rb b/plugins/providers/docker/action/build.rb index b56c1b54b9b..82f22df6e99 100644 --- a/plugins/providers/docker/action/build.rb +++ b/plugins/providers/docker/action/build.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" -require "vagrant/util/ansi_escape_code_remover" +Vagrant.require "vagrant/util/ansi_escape_code_remover" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/connect_networks.rb b/plugins/providers/docker/action/connect_networks.rb index c2d67e9a779..3a116fbca4f 100644 --- a/plugins/providers/docker/action/connect_networks.rb +++ b/plugins/providers/docker/action/connect_networks.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'ipaddr' -require 'log4r' +Vagrant.require 'ipaddr' +Vagrant.require 'log4r' -require 'vagrant/util/scoped_hash_override' +Vagrant.require 'vagrant/util/scoped_hash_override' module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/destroy_build_image.rb b/plugins/providers/docker/action/destroy_build_image.rb index e28b6c4a77c..b0696fc623a 100644 --- a/plugins/providers/docker/action/destroy_build_image.rb +++ b/plugins/providers/docker/action/destroy_build_image.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/destroy_network.rb b/plugins/providers/docker/action/destroy_network.rb index 86131cde6b1..e11b12298b1 100644 --- a/plugins/providers/docker/action/destroy_network.rb +++ b/plugins/providers/docker/action/destroy_network.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'log4r' +Vagrant.require 'log4r' module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/host_machine.rb b/plugins/providers/docker/action/host_machine.rb index 460ad41fd70..a5f0f417ab6 100644 --- a/plugins/providers/docker/action/host_machine.rb +++ b/plugins/providers/docker/action/host_machine.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/host_machine_build_dir.rb b/plugins/providers/docker/action/host_machine_build_dir.rb index 79056ed7261..6b981fc3864 100644 --- a/plugins/providers/docker/action/host_machine_build_dir.rb +++ b/plugins/providers/docker/action/host_machine_build_dir.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/md5" - -require "log4r" +Vagrant.require "digest/md5" +Vagrant.require "log4r" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/host_machine_sync_folders.rb b/plugins/providers/docker/action/host_machine_sync_folders.rb index 2374ea48e62..2ad15d7a556 100644 --- a/plugins/providers/docker/action/host_machine_sync_folders.rb +++ b/plugins/providers/docker/action/host_machine_sync_folders.rb @@ -1,12 +1,11 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/md5" -require "securerandom" +Vagrant.require "digest/md5" +Vagrant.require "securerandom" +Vagrant.require "log4r" -require "log4r" - -require "vagrant/action/builtin/mixin_synced_folders" +Vagrant.require "vagrant/action/builtin/mixin_synced_folders" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/host_machine_sync_folders_disable.rb b/plugins/providers/docker/action/host_machine_sync_folders_disable.rb index 639af8b12a8..463faa85299 100644 --- a/plugins/providers/docker/action/host_machine_sync_folders_disable.rb +++ b/plugins/providers/docker/action/host_machine_sync_folders_disable.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" -require "vagrant/action/builtin/mixin_synced_folders" +Vagrant.require "vagrant/action/builtin/mixin_synced_folders" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/login.rb b/plugins/providers/docker/action/login.rb index 02a5b18d5bf..29325a1a0b0 100644 --- a/plugins/providers/docker/action/login.rb +++ b/plugins/providers/docker/action/login.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/prepare_networks.rb b/plugins/providers/docker/action/prepare_networks.rb index 2723d4cad1a..3d44adc549e 100644 --- a/plugins/providers/docker/action/prepare_networks.rb +++ b/plugins/providers/docker/action/prepare_networks.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'ipaddr' -require 'log4r' +Vagrant.require 'ipaddr' +Vagrant.require 'log4r' -require 'vagrant/util/scoped_hash_override' +Vagrant.require 'vagrant/util/scoped_hash_override' module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/action/wait_for_running.rb b/plugins/providers/docker/action/wait_for_running.rb index 237cfe45556..3863865d036 100644 --- a/plugins/providers/docker/action/wait_for_running.rb +++ b/plugins/providers/docker/action/wait_for_running.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "thread" - -require "log4r" +Vagrant.require "thread" +Vagrant.require "log4r" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/communicator.rb b/plugins/providers/docker/communicator.rb index 1e13485dbe4..81dcdf37973 100644 --- a/plugins/providers/docker/communicator.rb +++ b/plugins/providers/docker/communicator.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/md5" -require "tempfile" +Vagrant.require "digest/md5" +Vagrant.require "tempfile" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/config.rb b/plugins/providers/docker/config.rb index dfababb5358..3b7682b4418 100644 --- a/plugins/providers/docker/config.rb +++ b/plugins/providers/docker/config.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" +Vagrant.require "pathname" require_relative "../../../lib/vagrant/util/platform" diff --git a/plugins/providers/docker/driver.rb b/plugins/providers/docker/driver.rb index 460c744e0ed..f71ec167368 100644 --- a/plugins/providers/docker/driver.rb +++ b/plugins/providers/docker/driver.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" -require "log4r" +Vagrant.require "json" +Vagrant.require "log4r" require_relative "./driver/compose" diff --git a/plugins/providers/docker/driver/compose.rb b/plugins/providers/docker/driver/compose.rb index 64a59b16f6c..2b1d42307ad 100644 --- a/plugins/providers/docker/driver/compose.rb +++ b/plugins/providers/docker/driver/compose.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" -require "log4r" +Vagrant.require "json" +Vagrant.require "log4r" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/docker/provider.rb b/plugins/providers/docker/provider.rb index 3efac65a230..f14effda680 100644 --- a/plugins/providers/docker/provider.rb +++ b/plugins/providers/docker/provider.rb @@ -1,13 +1,12 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/md5" -require "fileutils" -require "thread" +Vagrant.require "digest/md5" +Vagrant.require "fileutils" +Vagrant.require "thread" +Vagrant.require "log4r" -require "log4r" - -require "vagrant/util/silence_warnings" +Vagrant.require "vagrant/util/silence_warnings" module VagrantPlugins module DockerProvider diff --git a/plugins/providers/hyperv/action/check_enabled.rb b/plugins/providers/hyperv/action/check_enabled.rb index 547aa459b8d..ac3e3ff6a26 100644 --- a/plugins/providers/hyperv/action/check_enabled.rb +++ b/plugins/providers/hyperv/action/check_enabled.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" - -require "log4r" +Vagrant.require "fileutils" +Vagrant.require "log4r" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/action/configure.rb b/plugins/providers/hyperv/action/configure.rb index 6958fd455c0..207271a9161 100644 --- a/plugins/providers/hyperv/action/configure.rb +++ b/plugins/providers/hyperv/action/configure.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" - -require "log4r" +Vagrant.require "fileutils" +Vagrant.require "log4r" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/action/export.rb b/plugins/providers/hyperv/action/export.rb index 1d15740777b..2950ef83a1a 100644 --- a/plugins/providers/hyperv/action/export.rb +++ b/plugins/providers/hyperv/action/export.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" +Vagrant.require "fileutils" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/action/import.rb b/plugins/providers/hyperv/action/import.rb index f901d1af9f9..e592c07a736 100644 --- a/plugins/providers/hyperv/action/import.rb +++ b/plugins/providers/hyperv/action/import.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" -require "log4r" +Vagrant.require "fileutils" +Vagrant.require "log4r" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/action/package_metadata_json.rb b/plugins/providers/hyperv/action/package_metadata_json.rb index d874d4385c9..f474acd4fdb 100644 --- a/plugins/providers/hyperv/action/package_metadata_json.rb +++ b/plugins/providers/hyperv/action/package_metadata_json.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" +Vagrant.require "json" #require 'vagrant/util/template_renderer' diff --git a/plugins/providers/hyperv/action/package_setup_folders.rb b/plugins/providers/hyperv/action/package_setup_folders.rb index e6b0147be9c..2166c341afa 100644 --- a/plugins/providers/hyperv/action/package_setup_folders.rb +++ b/plugins/providers/hyperv/action/package_setup_folders.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" +Vagrant.require "fileutils" require_relative "../../../../lib/vagrant/action/general/package_setup_folders" diff --git a/plugins/providers/hyperv/action/read_guest_ip.rb b/plugins/providers/hyperv/action/read_guest_ip.rb index 93f0a3e91ed..9867484671d 100644 --- a/plugins/providers/hyperv/action/read_guest_ip.rb +++ b/plugins/providers/hyperv/action/read_guest_ip.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "timeout" +Vagrant.require "log4r" +Vagrant.require "timeout" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/action/read_state.rb b/plugins/providers/hyperv/action/read_state.rb index 7243da43303..4fa820c2a7e 100644 --- a/plugins/providers/hyperv/action/read_state.rb +++ b/plugins/providers/hyperv/action/read_state.rb @@ -1,8 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 - -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/action/set_name.rb b/plugins/providers/hyperv/action/set_name.rb index 86e8b9817be..ca108935c18 100644 --- a/plugins/providers/hyperv/action/set_name.rb +++ b/plugins/providers/hyperv/action/set_name.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/action/wait_for_ip_address.rb b/plugins/providers/hyperv/action/wait_for_ip_address.rb index 9ded3031bfa..af4371e12f2 100644 --- a/plugins/providers/hyperv/action/wait_for_ip_address.rb +++ b/plugins/providers/hyperv/action/wait_for_ip_address.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "ipaddr" -require "timeout" +Vagrant.require "ipaddr" +Vagrant.require "timeout" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/cap/cleanup_disks.rb b/plugins/providers/hyperv/cap/cleanup_disks.rb index 1dcc1f2dba3..aee2e3875df 100644 --- a/plugins/providers/hyperv/cap/cleanup_disks.rb +++ b/plugins/providers/hyperv/cap/cleanup_disks.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "vagrant/util/experimental" +Vagrant.require "log4r" +Vagrant.require "vagrant/util/experimental" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/cap/configure_disks.rb b/plugins/providers/hyperv/cap/configure_disks.rb index f6a42e20b80..0655e2333a8 100644 --- a/plugins/providers/hyperv/cap/configure_disks.rb +++ b/plugins/providers/hyperv/cap/configure_disks.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "fileutils" -require "vagrant/util/numeric" -require "vagrant/util/experimental" +Vagrant.require "log4r" +Vagrant.require "fileutils" +Vagrant.require "vagrant/util/numeric" +Vagrant.require "vagrant/util/experimental" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/cap/validate_disk_ext.rb b/plugins/providers/hyperv/cap/validate_disk_ext.rb index 208643e721b..d29d218a3e7 100644 --- a/plugins/providers/hyperv/cap/validate_disk_ext.rb +++ b/plugins/providers/hyperv/cap/validate_disk_ext.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module HyperV diff --git a/plugins/providers/hyperv/driver.rb b/plugins/providers/hyperv/driver.rb index 23395bc16f6..a312f8fc145 100644 --- a/plugins/providers/hyperv/driver.rb +++ b/plugins/providers/hyperv/driver.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "json" -require "log4r" +Vagrant.require "json" +Vagrant.require "log4r" -require "vagrant/util/powershell" +Vagrant.require "vagrant/util/powershell" require_relative "plugin" diff --git a/plugins/providers/hyperv/provider.rb b/plugins/providers/hyperv/provider.rb index f2322423658..52b32e1f7d2 100644 --- a/plugins/providers/hyperv/provider.rb +++ b/plugins/providers/hyperv/provider.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" require_relative "driver" require_relative "plugin" diff --git a/plugins/providers/virtualbox/action/check_guest_additions.rb b/plugins/providers/virtualbox/action/check_guest_additions.rb index 6cdc4c6843a..53a63f2e9a6 100644 --- a/plugins/providers/virtualbox/action/check_guest_additions.rb +++ b/plugins/providers/virtualbox/action/check_guest_additions.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/clean_machine_folder.rb b/plugins/providers/virtualbox/action/clean_machine_folder.rb index fd278a6a5b2..9fa026ecaed 100644 --- a/plugins/providers/virtualbox/action/clean_machine_folder.rb +++ b/plugins/providers/virtualbox/action/clean_machine_folder.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" +Vagrant.require "fileutils" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb b/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb index 20091d6b280..b6669ad0138 100644 --- a/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb +++ b/plugins/providers/virtualbox/action/destroy_unused_network_interfaces.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/export.rb b/plugins/providers/virtualbox/action/export.rb index a1d27112cac..5098c820cf1 100644 --- a/plugins/providers/virtualbox/action/export.rb +++ b/plugins/providers/virtualbox/action/export.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" -require 'vagrant/util/platform' +Vagrant.require "fileutils" +Vagrant.require 'vagrant/util/platform' module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/import_master.rb b/plugins/providers/virtualbox/action/import_master.rb index 7e70b94b3be..58f7ebd0492 100644 --- a/plugins/providers/virtualbox/action/import_master.rb +++ b/plugins/providers/virtualbox/action/import_master.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" - -require "digest/md5" +Vagrant.require "log4r" +Vagrant.require "digest/md5" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/network.rb b/plugins/providers/virtualbox/action/network.rb index 13342932a44..08799c32025 100644 --- a/plugins/providers/virtualbox/action/network.rb +++ b/plugins/providers/virtualbox/action/network.rb @@ -1,14 +1,14 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "ipaddr" -require "resolv" -require "set" +Vagrant.require "ipaddr" +Vagrant.require "resolv" +Vagrant.require "set" -require "log4r" +Vagrant.require "log4r" -require "vagrant/util/network_ip" -require "vagrant/util/scoped_hash_override" +Vagrant.require "vagrant/util/network_ip" +Vagrant.require "vagrant/util/scoped_hash_override" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/network_fix_ipv6.rb b/plugins/providers/virtualbox/action/network_fix_ipv6.rb index 2de31b57de5..e1abe845280 100644 --- a/plugins/providers/virtualbox/action/network_fix_ipv6.rb +++ b/plugins/providers/virtualbox/action/network_fix_ipv6.rb @@ -1,13 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "ipaddr" -require "socket" +Vagrant.require "ipaddr" +Vagrant.require "socket" -require "log4r" +Vagrant.require "log4r" -require "vagrant/util/presence" -require "vagrant/util/scoped_hash_override" +Vagrant.require "vagrant/util/presence" +Vagrant.require "vagrant/util/scoped_hash_override" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/package_setup_folders.rb b/plugins/providers/virtualbox/action/package_setup_folders.rb index 9be34e6a5ed..69eec8abffd 100644 --- a/plugins/providers/virtualbox/action/package_setup_folders.rb +++ b/plugins/providers/virtualbox/action/package_setup_folders.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" +Vagrant.require "fileutils" require_relative "../../../../lib/vagrant/action/general/package_setup_folders" diff --git a/plugins/providers/virtualbox/action/prepare_clone_snapshot.rb b/plugins/providers/virtualbox/action/prepare_clone_snapshot.rb index b40b81b299a..8b9c113d0f5 100644 --- a/plugins/providers/virtualbox/action/prepare_clone_snapshot.rb +++ b/plugins/providers/virtualbox/action/prepare_clone_snapshot.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" - -require "digest/md5" +Vagrant.require "log4r" +Vagrant.require "digest/md5" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/prepare_nfs_settings.rb b/plugins/providers/virtualbox/action/prepare_nfs_settings.rb index f8dc9856309..4c4772f4fc5 100644 --- a/plugins/providers/virtualbox/action/prepare_nfs_settings.rb +++ b/plugins/providers/virtualbox/action/prepare_nfs_settings.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "ipaddr" -require "vagrant/action/builtin/mixin_synced_folders" +Vagrant.require "ipaddr" +Vagrant.require "vagrant/action/builtin/mixin_synced_folders" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/sane_defaults.rb b/plugins/providers/virtualbox/action/sane_defaults.rb index 6b4a0d8abb0..212a31a0c9d 100644 --- a/plugins/providers/virtualbox/action/sane_defaults.rb +++ b/plugins/providers/virtualbox/action/sane_defaults.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/set_default_nic_type.rb b/plugins/providers/virtualbox/action/set_default_nic_type.rb index 514fca67da8..057307383b4 100644 --- a/plugins/providers/virtualbox/action/set_default_nic_type.rb +++ b/plugins/providers/virtualbox/action/set_default_nic_type.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/set_name.rb b/plugins/providers/virtualbox/action/set_name.rb index 491c7456162..17a3e2f43d1 100644 --- a/plugins/providers/virtualbox/action/set_name.rb +++ b/plugins/providers/virtualbox/action/set_name.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/action/setup_package_files.rb b/plugins/providers/virtualbox/action/setup_package_files.rb index 76d76439be5..179233dc4ea 100644 --- a/plugins/providers/virtualbox/action/setup_package_files.rb +++ b/plugins/providers/virtualbox/action/setup_package_files.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" require_relative "package_setup_files" diff --git a/plugins/providers/virtualbox/cap/cleanup_disks.rb b/plugins/providers/virtualbox/cap/cleanup_disks.rb index ca4aecb89f5..0d6918bfadf 100644 --- a/plugins/providers/virtualbox/cap/cleanup_disks.rb +++ b/plugins/providers/virtualbox/cap/cleanup_disks.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "vagrant/util/experimental" +Vagrant.require "log4r" +Vagrant.require "vagrant/util/experimental" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/cap/configure_disks.rb b/plugins/providers/virtualbox/cap/configure_disks.rb index 501a6354a09..365fdb31630 100644 --- a/plugins/providers/virtualbox/cap/configure_disks.rb +++ b/plugins/providers/virtualbox/cap/configure_disks.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "fileutils" -require "vagrant/util/numeric" -require "vagrant/util/experimental" +Vagrant.require "log4r" +Vagrant.require "fileutils" +Vagrant.require "vagrant/util/numeric" +Vagrant.require "vagrant/util/experimental" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/cap/validate_disk_ext.rb b/plugins/providers/virtualbox/cap/validate_disk_ext.rb index 00f3d0efcbb..2f5f87058d8 100644 --- a/plugins/providers/virtualbox/cap/validate_disk_ext.rb +++ b/plugins/providers/virtualbox/cap/validate_disk_ext.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/driver/base.rb b/plugins/providers/virtualbox/driver/base.rb index 7d1739ba26f..ea229b640c0 100644 --- a/plugins/providers/virtualbox/driver/base.rb +++ b/plugins/providers/virtualbox/driver/base.rb @@ -1,13 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'log4r' +Vagrant.require 'log4r' -require 'vagrant/util/busy' -require 'vagrant/util/platform' -require 'vagrant/util/retryable' -require 'vagrant/util/subprocess' -require 'vagrant/util/which' +Vagrant.require 'vagrant/util/busy' +Vagrant.require 'vagrant/util/platform' +Vagrant.require 'vagrant/util/retryable' +Vagrant.require 'vagrant/util/subprocess' +Vagrant.require 'vagrant/util/which' module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/driver/version_4_1.rb b/plugins/providers/virtualbox/driver/version_4_1.rb index cfeaf825e80..a892ab3b55e 100644 --- a/plugins/providers/virtualbox/driver/version_4_1.rb +++ b/plugins/providers/virtualbox/driver/version_4_1.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'log4r' - -require "vagrant/util/platform" +Vagrant.require 'log4r' +Vagrant.require "vagrant/util/platform" require File.expand_path("../base", __FILE__) diff --git a/plugins/providers/virtualbox/driver/version_7_0.rb b/plugins/providers/virtualbox/driver/version_7_0.rb index a852841d760..e6e1b473c85 100644 --- a/plugins/providers/virtualbox/driver/version_7_0.rb +++ b/plugins/providers/virtualbox/driver/version_7_0.rb @@ -1,7 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "rexml" +Vagrant.require "rexml" + require File.expand_path("../version_6_1", __FILE__) module VagrantPlugins diff --git a/plugins/providers/virtualbox/provider.rb b/plugins/providers/virtualbox/provider.rb index de934c07237..16abd44ff9c 100644 --- a/plugins/providers/virtualbox/provider.rb +++ b/plugins/providers/virtualbox/provider.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/providers/virtualbox/synced_folder.rb b/plugins/providers/virtualbox/synced_folder.rb index 623d0f9e1f7..771de1c7427 100644 --- a/plugins/providers/virtualbox/synced_folder.rb +++ b/plugins/providers/virtualbox/synced_folder.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" -require "vagrant/util/platform" +Vagrant.require "fileutils" +Vagrant.require "vagrant/util/platform" module VagrantPlugins module ProviderVirtualBox diff --git a/plugins/provisioners/ansible/provisioner/guest.rb b/plugins/provisioners/ansible/provisioner/guest.rb index e4bf53eec6b..9727037e5cf 100644 --- a/plugins/provisioners/ansible/provisioner/guest.rb +++ b/plugins/provisioners/ansible/provisioner/guest.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "base" diff --git a/plugins/provisioners/ansible/provisioner/host.rb b/plugins/provisioners/ansible/provisioner/host.rb index 9f9dc5d0d59..577be9bff62 100644 --- a/plugins/provisioners/ansible/provisioner/host.rb +++ b/plugins/provisioners/ansible/provisioner/host.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "thread" +Vagrant.require "thread" require_relative "base" diff --git a/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb b/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb index bc1ec929ed7..fc543f77377 100644 --- a/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb +++ b/plugins/provisioners/cfengine/cap/linux/cfengine_needs_bootstrap.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module CFEngine diff --git a/plugins/provisioners/cfengine/cap/redhat/cfengine_install.rb b/plugins/provisioners/cfengine/cap/redhat/cfengine_install.rb index 6c753359812..b77e4d86657 100644 --- a/plugins/provisioners/cfengine/cap/redhat/cfengine_install.rb +++ b/plugins/provisioners/cfengine/cap/redhat/cfengine_install.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module CFEngine diff --git a/plugins/provisioners/cfengine/config.rb b/plugins/provisioners/cfengine/config.rb index 28d19880bb0..57ca872fb25 100644 --- a/plugins/provisioners/cfengine/config.rb +++ b/plugins/provisioners/cfengine/config.rb @@ -1,9 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" - -require "vagrant" +Vagrant.require "pathname" module VagrantPlugins module CFEngine diff --git a/plugins/provisioners/cfengine/provisioner.rb b/plugins/provisioners/cfengine/provisioner.rb index 7db51932c62..66dcddc99e3 100644 --- a/plugins/provisioners/cfengine/provisioner.rb +++ b/plugins/provisioners/cfengine/provisioner.rb @@ -1,8 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require "vagrant" +Vagrant.require "log4r" module VagrantPlugins module CFEngine diff --git a/plugins/provisioners/chef/plugin.rb b/plugins/provisioners/chef/plugin.rb index 24d6f01a6ca..df450767be8 100644 --- a/plugins/provisioners/chef/plugin.rb +++ b/plugins/provisioners/chef/plugin.rb @@ -1,9 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" - -require "vagrant" +Vagrant.require "pathname" require_relative "command_builder" diff --git a/plugins/provisioners/chef/provisioner/base.rb b/plugins/provisioners/chef/provisioner/base.rb index fad7574b1d4..042123a426c 100644 --- a/plugins/provisioners/chef/provisioner/base.rb +++ b/plugins/provisioners/chef/provisioner/base.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "tempfile" +Vagrant.require "tempfile" require_relative "../../../../lib/vagrant/util/presence" require_relative "../../../../lib/vagrant/util/template_renderer" diff --git a/plugins/provisioners/chef/provisioner/chef_apply.rb b/plugins/provisioners/chef/provisioner/chef_apply.rb index 74f2033c04e..ae69cfddd59 100644 --- a/plugins/provisioners/chef/provisioner/chef_apply.rb +++ b/plugins/provisioners/chef/provisioner/chef_apply.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/md5" -require "tempfile" +Vagrant.require "digest/md5" +Vagrant.require "tempfile" require_relative "base" diff --git a/plugins/provisioners/chef/provisioner/chef_client.rb b/plugins/provisioners/chef/provisioner/chef_client.rb index c6f939ad6b5..b917606a1ff 100644 --- a/plugins/provisioners/chef/provisioner/chef_client.rb +++ b/plugins/provisioners/chef/provisioner/chef_client.rb @@ -1,11 +1,11 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'pathname' +Vagrant.require 'pathname' -require 'vagrant' -require 'vagrant/util/presence' -require 'vagrant/util/subprocess' +Vagrant.require 'vagrant' +Vagrant.require 'vagrant/util/presence' +Vagrant.require 'vagrant/util/subprocess' require_relative "base" diff --git a/plugins/provisioners/chef/provisioner/chef_zero.rb b/plugins/provisioners/chef/provisioner/chef_zero.rb index a3a47057b5a..c2837dd78f0 100644 --- a/plugins/provisioners/chef/provisioner/chef_zero.rb +++ b/plugins/provisioners/chef/provisioner/chef_zero.rb @@ -1,13 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/md5" -require "securerandom" -require "set" +Vagrant.require "digest/md5" +Vagrant.require "securerandom" +Vagrant.require "set" -require "log4r" +Vagrant.require "log4r" -require "vagrant/util/counter" +Vagrant.require "vagrant/util/counter" require_relative "chef_solo" diff --git a/plugins/provisioners/container/client.rb b/plugins/provisioners/container/client.rb index d04f43a059c..57fd2fabeef 100644 --- a/plugins/provisioners/container/client.rb +++ b/plugins/provisioners/container/client.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'digest/sha1' +Vagrant.require 'digest/sha1' module VagrantPlugins module ContainerProvisioner diff --git a/plugins/provisioners/container/config.rb b/plugins/provisioners/container/config.rb index 9edc6fa63c6..f910b9202a1 100644 --- a/plugins/provisioners/container/config.rb +++ b/plugins/provisioners/container/config.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'set' +Vagrant.require 'set' module VagrantPlugins module ContainerProvisioner diff --git a/plugins/provisioners/file/config.rb b/plugins/provisioners/file/config.rb index 6dce6509e6a..0e8fe80b381 100644 --- a/plugins/provisioners/file/config.rb +++ b/plugins/provisioners/file/config.rb @@ -1,9 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" - -require "vagrant" +Vagrant.require "pathname" module VagrantPlugins module FileUpload diff --git a/plugins/provisioners/puppet/provisioner/puppet.rb b/plugins/provisioners/puppet/provisioner/puppet.rb index 26fe2234755..39404ec3592 100644 --- a/plugins/provisioners/puppet/provisioner/puppet.rb +++ b/plugins/provisioners/puppet/provisioner/puppet.rb @@ -1,9 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/md5" - -require "log4r" +Vagrant.require "digest/md5" +Vagrant.require "log4r" module VagrantPlugins module Puppet diff --git a/plugins/provisioners/salt/bootstrap_downloader.rb b/plugins/provisioners/salt/bootstrap_downloader.rb index 8c0abd03637..2b048f8e0bf 100644 --- a/plugins/provisioners/salt/bootstrap_downloader.rb +++ b/plugins/provisioners/salt/bootstrap_downloader.rb @@ -1,8 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'open-uri' -require 'digest' +Vagrant.require 'open-uri' +Vagrant.require 'digest' + require_relative "./errors" module VagrantPlugins diff --git a/plugins/provisioners/salt/provisioner.rb b/plugins/provisioners/salt/provisioner.rb index 1047e945626..a7d96dc8fe7 100644 --- a/plugins/provisioners/salt/provisioner.rb +++ b/plugins/provisioners/salt/provisioner.rb @@ -1,7 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'json' +Vagrant.require 'json' + require_relative "bootstrap_downloader" module VagrantPlugins diff --git a/plugins/provisioners/shell/config.rb b/plugins/provisioners/shell/config.rb index ce10c6bf92c..8a1e2013d33 100644 --- a/plugins/provisioners/shell/config.rb +++ b/plugins/provisioners/shell/config.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'uri' +Vagrant.require 'uri' module VagrantPlugins module Shell diff --git a/plugins/provisioners/shell/provisioner.rb b/plugins/provisioners/shell/provisioner.rb index e1cf591496c..fc320b49a4f 100644 --- a/plugins/provisioners/shell/provisioner.rb +++ b/plugins/provisioners/shell/provisioner.rb @@ -1,12 +1,12 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" -require "tempfile" +Vagrant.require "pathname" +Vagrant.require "tempfile" -require "vagrant/util/downloader" -require "vagrant/util/line_buffer" -require "vagrant/util/retryable" +Vagrant.require "vagrant/util/downloader" +Vagrant.require "vagrant/util/line_buffer" +Vagrant.require "vagrant/util/retryable" module VagrantPlugins module Shell diff --git a/plugins/pushes/ftp/adapter.rb b/plugins/pushes/ftp/adapter.rb index 535d44625fa..2085113745e 100644 --- a/plugins/pushes/ftp/adapter.rb +++ b/plugins/pushes/ftp/adapter.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "pathname" +Vagrant.require "pathname" module VagrantPlugins module FTPPush @@ -50,7 +50,7 @@ def upload(local, remote) # class FTPAdapter < Adapter def initialize(*) - require "net/ftp" + Vagrant.require "net/ftp" super end @@ -107,7 +107,7 @@ def pwd # class SFTPAdapter < Adapter def initialize(*) - require "net/sftp" + Vagrant.require "net/sftp" super @dirs = {} end diff --git a/plugins/pushes/ftp/push.rb b/plugins/pushes/ftp/push.rb index 9c85a001dc3..5717c984931 100644 --- a/plugins/pushes/ftp/push.rb +++ b/plugins/pushes/ftp/push.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "net/ftp" -require "pathname" +Vagrant.require "net/ftp" +Vagrant.require "pathname" require_relative "adapter" require_relative "errors" diff --git a/plugins/pushes/local-exec/push.rb b/plugins/pushes/local-exec/push.rb index 429f6a22640..43ff353bbf6 100644 --- a/plugins/pushes/local-exec/push.rb +++ b/plugins/pushes/local-exec/push.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" -require "tempfile" -require "vagrant/util/safe_exec" +Vagrant.require "fileutils" +Vagrant.require "tempfile" +Vagrant.require "vagrant/util/safe_exec" require_relative "errors" diff --git a/plugins/synced_folders/nfs/action_cleanup.rb b/plugins/synced_folders/nfs/action_cleanup.rb index eadf865dab6..b3f526310e2 100644 --- a/plugins/synced_folders/nfs/action_cleanup.rb +++ b/plugins/synced_folders/nfs/action_cleanup.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" module VagrantPlugins module SyncedFolderNFS diff --git a/plugins/synced_folders/nfs/synced_folder.rb b/plugins/synced_folders/nfs/synced_folder.rb index 44efcf37a46..4bb8e27da24 100644 --- a/plugins/synced_folders/nfs/synced_folder.rb +++ b/plugins/synced_folders/nfs/synced_folder.rb @@ -1,13 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'fileutils' -require 'thread' -require 'zlib' +Vagrant.require 'fileutils' +Vagrant.require 'thread' +Vagrant.require 'zlib' -require "log4r" +Vagrant.require "log4r" -require "vagrant/util/platform" +Vagrant.require "vagrant/util/platform" module VagrantPlugins module SyncedFolderNFS diff --git a/plugins/synced_folders/rsync/command/rsync.rb b/plugins/synced_folders/rsync/command/rsync.rb index 8268b32d27b..a02c2ace783 100644 --- a/plugins/synced_folders/rsync/command/rsync.rb +++ b/plugins/synced_folders/rsync/command/rsync.rb @@ -1,9 +1,9 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require 'optparse' +Vagrant.require 'optparse' -require "vagrant/action/builtin/mixin_synced_folders" +Vagrant.require "vagrant/action/builtin/mixin_synced_folders" require_relative "../helper" diff --git a/plugins/synced_folders/rsync/command/rsync_auto.rb b/plugins/synced_folders/rsync/command/rsync_auto.rb index b269ddb9778..bcc09325127 100644 --- a/plugins/synced_folders/rsync/command/rsync_auto.rb +++ b/plugins/synced_folders/rsync/command/rsync_auto.rb @@ -1,17 +1,17 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" -require 'optparse' -require "thread" +Vagrant.require "log4r" +Vagrant.require 'optparse' +Vagrant.require "thread" -require "vagrant/action/builtin/mixin_synced_folders" -require "vagrant/util/busy" -require "vagrant/util/platform" +Vagrant.require "vagrant/action/builtin/mixin_synced_folders" +Vagrant.require "vagrant/util/busy" +Vagrant.require "vagrant/util/platform" require_relative "../helper" -require "listen" +Vagrant.require "listen" module VagrantPlugins module SyncedFolderRSync diff --git a/plugins/synced_folders/rsync/default_unix_cap.rb b/plugins/synced_folders/rsync/default_unix_cap.rb index f39244a33b6..91371ff796c 100644 --- a/plugins/synced_folders/rsync/default_unix_cap.rb +++ b/plugins/synced_folders/rsync/default_unix_cap.rb @@ -1,7 +1,7 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "shellwords" +Vagrant.require "shellwords" module VagrantPlugins module SyncedFolderRSync diff --git a/plugins/synced_folders/rsync/helper.rb b/plugins/synced_folders/rsync/helper.rb index d6c2180ebdf..91c94b7b86f 100644 --- a/plugins/synced_folders/rsync/helper.rb +++ b/plugins/synced_folders/rsync/helper.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "fileutils" -require "ipaddr" -require "shellwords" -require "tmpdir" +Vagrant.require "fileutils" +Vagrant.require "ipaddr" +Vagrant.require "shellwords" +Vagrant.require "tmpdir" require "vagrant/util/platform" require "vagrant/util/subprocess" diff --git a/plugins/synced_folders/rsync/synced_folder.rb b/plugins/synced_folders/rsync/synced_folder.rb index caef81e604c..28971a9fcb3 100644 --- a/plugins/synced_folders/rsync/synced_folder.rb +++ b/plugins/synced_folders/rsync/synced_folder.rb @@ -1,10 +1,10 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "log4r" +Vagrant.require "log4r" -require "vagrant/util/subprocess" -require "vagrant/util/which" +Vagrant.require "vagrant/util/subprocess" +Vagrant.require "vagrant/util/which" require_relative "helper" diff --git a/plugins/synced_folders/smb/synced_folder.rb b/plugins/synced_folders/smb/synced_folder.rb index 4b18e8252f2..53292c887e7 100644 --- a/plugins/synced_folders/smb/synced_folder.rb +++ b/plugins/synced_folders/smb/synced_folder.rb @@ -1,13 +1,13 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "digest/md5" -require "json" +Vagrant.require "digest/md5" +Vagrant.require "json" -require "log4r" +Vagrant.require "log4r" -require "vagrant/util/platform" -require "vagrant/util/powershell" +Vagrant.require "vagrant/util/platform" +Vagrant.require "vagrant/util/powershell" require_relative "errors" diff --git a/plugins/synced_folders/unix_mount_helpers.rb b/plugins/synced_folders/unix_mount_helpers.rb index 88269ec4afa..3462f127474 100644 --- a/plugins/synced_folders/unix_mount_helpers.rb +++ b/plugins/synced_folders/unix_mount_helpers.rb @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -require "shellwords" -require "vagrant/util/retryable" +Vagrant.require "shellwords" +Vagrant.require "vagrant/util/retryable" module VagrantPlugins module SyncedFolder diff --git a/test/unit/plugins/guests/linux/cap/mount_smb_shared_folder_test.rb b/test/unit/plugins/guests/linux/cap/mount_smb_shared_folder_test.rb index 467cb863889..1c5e03a39b5 100644 --- a/test/unit/plugins/guests/linux/cap/mount_smb_shared_folder_test.rb +++ b/test/unit/plugins/guests/linux/cap/mount_smb_shared_folder_test.rb @@ -59,6 +59,7 @@ allow(comm).to receive(:execute).with(any_args) allow(machine).to receive(:guest).and_return(guest) allow(guest).to receive(:capability).with(:shell_expand_guest_path, mount_guest_path).and_return(mount_guest_path) + allow(ENV).to receive(:[]).and_call_original allow(ENV).to receive(:[]).with("VAGRANT_DISABLE_SMBMFSYMLINKS").and_return(false) allow(ENV).to receive(:[]).with("GEM_SKIP").and_return(false) allow(cap).to receive(:display_mfsymlinks_warning)