diff options
author | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
---|---|---|
committer | Alex Pilon <apilon@hashicorp.com> | 2019-02-22 18:24:37 -0500 |
commit | 15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch) | |
tree | 255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/hashicorp/terraform/config/module/get.go | |
parent | 07971ca38143c5faf951d152fba370ddcbe26ad5 (diff) | |
download | terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.gz terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.zst terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.zip |
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
Updated via: go get github.com/hashicorp/terraform@sdk-v0.11-with-go-modules and go mod tidy
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/config/module/get.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/config/module/get.go | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/vendor/github.com/hashicorp/terraform/config/module/get.go b/vendor/github.com/hashicorp/terraform/config/module/get.go index 96b4a63..5073d0d 100644 --- a/vendor/github.com/hashicorp/terraform/config/module/get.go +++ b/vendor/github.com/hashicorp/terraform/config/module/get.go | |||
@@ -3,6 +3,7 @@ package module | |||
3 | import ( | 3 | import ( |
4 | "io/ioutil" | 4 | "io/ioutil" |
5 | "os" | 5 | "os" |
6 | "path/filepath" | ||
6 | 7 | ||
7 | "github.com/hashicorp/go-getter" | 8 | "github.com/hashicorp/go-getter" |
8 | ) | 9 | ) |
@@ -37,13 +38,10 @@ func GetCopy(dst, src string) error { | |||
37 | if err != nil { | 38 | if err != nil { |
38 | return err | 39 | return err |
39 | } | 40 | } |
40 | // FIXME: This isn't completely safe. Creating and removing our temp path | ||
41 | // exposes where to race to inject files. | ||
42 | if err := os.RemoveAll(tmpDir); err != nil { | ||
43 | return err | ||
44 | } | ||
45 | defer os.RemoveAll(tmpDir) | 41 | defer os.RemoveAll(tmpDir) |
46 | 42 | ||
43 | tmpDir = filepath.Join(tmpDir, "module") | ||
44 | |||
47 | // Get to that temporary dir | 45 | // Get to that temporary dir |
48 | if err := getter.Get(tmpDir, src); err != nil { | 46 | if err := getter.Get(tmpDir, src); err != nil { |
49 | return err | 47 | return err |
@@ -57,15 +55,3 @@ func GetCopy(dst, src string) error { | |||
57 | // Copy to the final location | 55 | // Copy to the final location |
58 | return copyDir(dst, tmpDir) | 56 | return copyDir(dst, tmpDir) |
59 | } | 57 | } |
60 | |||
61 | func getStorage(s getter.Storage, key string, src string, mode GetMode) (string, bool, error) { | ||
62 | // Get the module with the level specified if we were told to. | ||
63 | if mode > GetModeNone { | ||
64 | if err := s.Get(key, src, mode == GetModeUpdate); err != nil { | ||
65 | return "", false, err | ||
66 | } | ||
67 | } | ||
68 | |||
69 | // Get the directory where the module is. | ||
70 | return s.Dir(key) | ||
71 | } | ||