From 053d658e528be982a0452cbbf09888a67b79abdf Mon Sep 17 00:00:00 2001 From: sophia Date: Wed, 13 Apr 2022 10:52:58 -0500 Subject: [PATCH] Get default provider from go side For now the go side will just return a hard coded value for the default provider. It should be implementing the algorithm defined at https://www.vagrantup.com/docs/providers/basic_usage.html#default-provider --- internal/core/project.go | 5 +++-- lib/vagrant/environment/remote.rb | 12 +++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/internal/core/project.go b/internal/core/project.go index e374cf61c..23fc83c56 100644 --- a/internal/core/project.go +++ b/internal/core/project.go @@ -100,8 +100,9 @@ func (p *Project) DefaultPrivateKey() (path path.Path, err error) { // DefaultProvider implements core.Project func (p *Project) DefaultProvider() (name string, err error) { - // TODO - return + // TODO: This needs to implement the default provider algorithm + // from https://www.vagrantup.com/docs/providers/basic_usage.html#default-provider + return "virtualbox", nil } // Home implements core.Project diff --git a/lib/vagrant/environment/remote.rb b/lib/vagrant/environment/remote.rb index feaf02520..79c68d4b8 100644 --- a/lib/vagrant/environment/remote.rb +++ b/lib/vagrant/environment/remote.rb @@ -24,8 +24,8 @@ module Vagrant opts[:ui_class] ||= UI::Remote @cwd = Pathname.new(@client.cwd) - @home_path = @client.respond_to?(:home) && Pathname.new(@client.home) - @vagrantfile_name = @client.respond_to?(:vagrantfile_name) && [@client.vagrantfile_name] + @home_path = Pathname.new(@client.home) + @vagrantfile_name = Array(@client.vagrantfile_name) @ui = opts.fetch(:ui, opts[:ui_class].new(@client.ui)) @local_data_path = Pathname.new(@client.local_data) @boxes_path = @home_path && @home_path.join("boxes") @@ -101,11 +101,9 @@ module Vagrant @config_loader end - # TODO: for now don't interfere with the default_provider method - # once it is implemented on the Go side then this can be uncommented - # def default_provider(**opts) - # client.default_provider - # end + def default_provider(**opts) + client.default_provider.to_sym + end # Returns the host object associated with this environment. #