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:
parent
ba5b0dc609
commit
270eedd4b8
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
|
@ -19,10 +20,13 @@ const DefaultDataDir = ".terraform"
|
||||||
// of directories supplied by the user with the `-plugin-dir` flag during init.
|
// of directories supplied by the user with the `-plugin-dir` flag during init.
|
||||||
const PluginPathFile = "plugin_path"
|
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
|
// DefaultPluginVendorDir is the location in the config directory to look for
|
||||||
// user-added plugin binaries. Terraform only reads from this path if it
|
// user-added plugin binaries. Terraform only reads from this path if it
|
||||||
// exists, it is never created by terraform.
|
// 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.
|
// DefaultStateFilename is the default filename used for the state file.
|
||||||
const DefaultStateFilename = "terraform.tfstate"
|
const DefaultStateFilename = "terraform.tfstate"
|
||||||
|
|
|
@ -519,11 +519,7 @@ func TestInit_findVendoredProviders(t *testing.T) {
|
||||||
if err := os.MkdirAll(c.pluginDir(), 0755); err != nil {
|
if err := os.MkdirAll(c.pluginDir(), 0755); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
vendorMachineDir := filepath.Join(
|
if err := os.MkdirAll(DefaultPluginVendorDir, 0755); err != nil {
|
||||||
DefaultPluginVendorDir,
|
|
||||||
fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH),
|
|
||||||
)
|
|
||||||
if err := os.MkdirAll(vendorMachineDir, 0755); err != nil {
|
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +530,7 @@ func TestInit_findVendoredProviders(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
// the vendor path
|
// 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 {
|
if err := ioutil.WriteFile(greaterThanPath, []byte("test bin"), 0755); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue