Skip to content

Commit 651b26a

Browse files
paddycarverkmoe
authored andcommitted
Drop symlinkAuxiliarProviders helper.
We don't actually use this helper anywhere, and it was incompatible with v1.5.0 of go-getter, for reasons.
1 parent 3e0c079 commit 651b26a

File tree

2 files changed

+1
-81
lines changed

2 files changed

+1
-81
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/hashicorp/errwrap v1.0.0
1919
github.com/hashicorp/go-cleanhttp v0.5.1
2020
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
21-
github.com/hashicorp/go-getter v1.5.0
21+
github.com/hashicorp/go-getter v1.5.0 // indirect
2222
github.com/hashicorp/go-hclog v0.9.2
2323
github.com/hashicorp/go-multierror v1.0.0
2424
github.com/hashicorp/go-plugin v1.3.0

internal/plugintest/helper.go

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ import (
44
"fmt"
55
"io/ioutil"
66
"os"
7-
"path/filepath"
8-
"runtime"
9-
"strings"
10-
11-
getter "github.com/hashicorp/go-getter"
127
)
138

149
const subprocessCurrentSigil = "4acd63807899403ca4859f5bb948d2c6"
@@ -85,81 +80,6 @@ func InitHelper(config *Config) (*Helper, error) {
8580
}, nil
8681
}
8782

88-
// symlinkAuxiliaryProviders discovers auxiliary provider binaries, used in
89-
// multi-provider tests, and symlinks them to the plugin directory.
90-
//
91-
// Auxiliary provider binaries should be included in the provider source code
92-
// directory, under the path terraform.d/plugins/$GOOS_$GOARCH/provider-name.
93-
//
94-
// The environment variable TF_ACC_PROVIDER_ROOT_DIR must be set to the path of
95-
// the provider source code directory root in order to use this feature.
96-
func symlinkAuxiliaryProviders(pluginDir string) error {
97-
providerRootDir := os.Getenv("TF_ACC_PROVIDER_ROOT_DIR")
98-
if providerRootDir == "" {
99-
// common case; assume intentional and do not log
100-
return nil
101-
}
102-
103-
_, err := os.Stat(filepath.Join(providerRootDir, "terraform.d", "plugins"))
104-
if os.IsNotExist(err) {
105-
fmt.Printf("No terraform.d/plugins directory found: continuing. Unset TF_ACC_PROVIDER_ROOT_DIR or supply provider binaries in terraform.d/plugins/$GOOS_$GOARCH to disable this message.")
106-
return nil
107-
} else if err != nil {
108-
return fmt.Errorf("Unexpected error: %s", err)
109-
}
110-
111-
auxiliaryProviderDir := filepath.Join(providerRootDir, "terraform.d", "plugins", runtime.GOOS+"_"+runtime.GOARCH)
112-
113-
// If we can't os.Stat() terraform.d/plugins/$GOOS_$GOARCH, however,
114-
// assume the omission was unintentional, and error.
115-
_, err = os.Stat(auxiliaryProviderDir)
116-
if os.IsNotExist(err) {
117-
return fmt.Errorf("error finding auxiliary provider dir %s: %s", auxiliaryProviderDir, err)
118-
} else if err != nil {
119-
return fmt.Errorf("Unexpected error: %s", err)
120-
}
121-
122-
// now find all the providers in that dir and symlink them to the plugin dir
123-
providers, err := ioutil.ReadDir(auxiliaryProviderDir)
124-
if err != nil {
125-
return fmt.Errorf("error reading auxiliary providers: %s", err)
126-
}
127-
128-
zipDecompressor := new(getter.ZipDecompressor)
129-
130-
for _, provider := range providers {
131-
filename := provider.Name()
132-
filenameExt := filepath.Ext(filename)
133-
name := strings.TrimSuffix(filename, filenameExt)
134-
path := filepath.Join(auxiliaryProviderDir, name)
135-
symlinkPath := filepath.Join(pluginDir, name)
136-
137-
// exit early if we have already symlinked this provider
138-
_, err := os.Stat(symlinkPath)
139-
if err == nil {
140-
continue
141-
}
142-
143-
// if filename ends in .zip, assume it is a zip and extract it
144-
// otherwise assume it is a provider binary
145-
if filenameExt == ".zip" {
146-
_, err = os.Stat(path)
147-
if os.IsNotExist(err) {
148-
zipDecompressor.Decompress(path, filepath.Join(auxiliaryProviderDir, filename), false)
149-
} else if err != nil {
150-
return fmt.Errorf("Unexpected error: %s", err)
151-
}
152-
}
153-
154-
err = symlinkFile(path, symlinkPath)
155-
if err != nil {
156-
return fmt.Errorf("error symlinking auxiliary provider %s: %s", name, err)
157-
}
158-
}
159-
160-
return nil
161-
}
162-
16383
// Close cleans up temporary files and directories created to support this
16484
// helper, returning an error if any of the cleanup fails.
16585
//

0 commit comments

Comments
 (0)