Remove local provider injection to machine

This commit is contained in:
Chris Roberts 2022-02-18 16:51:01 -08:00 committed by Paul Hinze
parent ab8dee7a72
commit 2b5bd64ec8
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -58,18 +58,7 @@ module VagrantPlugins
)
options = Type::Options.new(value: {}) if options.nil?
provider = plugin.new(machine)
# Within Ruby, many actions are defined inside provider plugins,
# and within their implementations they assume that
# `machine.provider` yields an instance of their provider. A common
# instance of this assumption would be a call like
# `machine.provider.driver.some_implementation_specific_method`.
#
# Because these assumptions are rampant within the Ruby
# implementations of providers, we break encapsulation here to set
# the local copy of the provider plugin on the machine.
machine.instance_variable_set(:@provider, provider)
provider = load_provider(plugin, machine)
callable = provider.action(action_name)
if callable.nil?