Commit 8b728794 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Default cache to "packer_cache" in CWD

parent cea6f90f
...@@ -36,16 +36,18 @@ func main() { ...@@ -36,16 +36,18 @@ func main() {
defer plugin.CleanupClients() defer plugin.CleanupClients()
var cache packer.Cache cacheDir := os.Getenv("PACKER_CACHE_DIR")
if cacheDir := os.Getenv("PACKER_CACHE_DIR"); cacheDir != "" { if cacheDir == "" {
cacheDir = "packer_cache"
}
if err := os.MkdirAll(cacheDir, 0755); err != nil { if err := os.MkdirAll(cacheDir, 0755); err != nil {
fmt.Fprintf(os.Stderr, "Error preparing cache directory: \n\n%s\n", err) fmt.Fprintf(os.Stderr, "Error preparing cache directory: \n\n%s\n", err)
os.Exit(1) os.Exit(1)
} }
log.Printf("Setting cache directory: %s", cacheDir) log.Printf("Setting cache directory: %s", cacheDir)
cache = &packer.FileCache{CacheDir: cacheDir} cache := &packer.FileCache{CacheDir: cacheDir}
}
envConfig := packer.DefaultEnvironmentConfig() envConfig := packer.DefaultEnvironmentConfig()
envConfig.Cache = cache envConfig.Cache = cache
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment