always pass in the full plugin path to dicovery

Discovery no longer tries to walk into OS_ARCH dirs, so always pass in
the full search path.
This commit is contained in:
James Bardin 2017-06-16 14:09:47 -04:00
parent ba5b0dc609
commit 270eedd4b8
2 changed files with 7 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os"
"runtime"
"github.com/hashicorp/terraform/terraform"
"github.com/mitchellh/cli"
@ -19,10 +20,13 @@ const DefaultDataDir = ".terraform"
// of directories supplied by the user with the `-plugin-dir` flag during init.
const PluginPathFile = "plugin_path"
// pluginMachineName is the directory name used in new plugin paths.
const pluginMachineName = runtime.GOOS + "_" + runtime.GOARCH
// DefaultPluginVendorDir is the location in the config directory to look for
// user-added plugin binaries. Terraform only reads from this path if it
// exists, it is never created by terraform.
const DefaultPluginVendorDir = "terraform.d/plugins"
const DefaultPluginVendorDir = "terraform.d/plugins/" + pluginMachineName
// DefaultStateFilename is the default filename used for the state file.
const DefaultStateFilename = "terraform.tfstate"

View File

@ -519,11 +519,7 @@ func TestInit_findVendoredProviders(t *testing.T) {
if err := os.MkdirAll(c.pluginDir(), 0755); err != nil {
t.Fatal(err)
}
vendorMachineDir := filepath.Join(
DefaultPluginVendorDir,
fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH),
)
if err := os.MkdirAll(vendorMachineDir, 0755); err != nil {
if err := os.MkdirAll(DefaultPluginVendorDir, 0755); err != nil {
t.Fatal(err)
}
@ -534,7 +530,7 @@ func TestInit_findVendoredProviders(t *testing.T) {
t.Fatal(err)
}
// the vendor path
greaterThanPath := filepath.Join(vendorMachineDir, "terraform-provider-greater_than_v2.3.4_x4")
greaterThanPath := filepath.Join(DefaultPluginVendorDir, "terraform-provider-greater_than_v2.3.4_x4")
if err := ioutil.WriteFile(greaterThanPath, []byte("test bin"), 0755); err != nil {
t.Fatal(err)
}