diff options
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 | } | ||