github.com/bendemaree/terraform@v0.5.4-0.20150613200311-f50d97d6eee6/config/module/storage.go (about) 1 package module 2 3 // Storage is an interface that knows how to lookup downloaded modules 4 // as well as download and update modules from their sources into the 5 // proper location. 6 type Storage interface { 7 // Dir returns the directory on local disk where the modulue source 8 // can be loaded from. 9 Dir(string) (string, bool, error) 10 11 // Get will download and optionally update the given module. 12 Get(string, string, bool) error 13 } 14 15 func getStorage(s Storage, key string, src string, mode GetMode) (string, bool, error) { 16 // Get the module with the level specified if we were told to. 17 if mode > GetModeNone { 18 if err := s.Get(key, src, mode == GetModeUpdate); err != nil { 19 return "", false, err 20 } 21 } 22 23 // Get the directory where the module is. 24 return s.Dir(key) 25 }