diff --git a/plugins/commands/serve/service/provider_service.rb b/plugins/commands/serve/service/provider_service.rb index 4b30500f3..4f1ad3c15 100644 --- a/plugins/commands/serve/service/provider_service.rb +++ b/plugins/commands/serve/service/provider_service.rb @@ -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?