Checkpoint

(configs to disable will come next)
This commit is contained in:
Mitchell Hashimoto 2014-09-08 14:10:17 -07:00
parent a8c4bb4464
commit 1c380ea521
1 changed files with 19 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import (
"path/filepath"
"runtime"
"github.com/hashicorp/go-checkpoint"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer/plugin"
"github.com/mitchellh/panicwrap"
@ -92,9 +93,26 @@ func wrappedMain() int {
fmt.Fprintf(os.Stderr, "Error loading configuration: \n\n%s\n", err)
return 1
}
log.Printf("Packer config: %+v", config)
configDir, err := ConfigDir()
if err != nil {
fmt.Fprintf(os.Stderr, "Error loading config dir: \n\n%s\n", err)
return 1
}
// Fire off the checkpoint.
version := packer.Version
if packer.VersionPrerelease != "" {
version += fmt.Sprintf(".%s", packer.VersionPrerelease)
}
go checkpoint.Check(&checkpoint.CheckParams{
Product: "packer",
Version: version,
SignatureFile: filepath.Join(configDir, "checkpoint_signature"),
CacheFile: filepath.Join(configDir, "checkpoint_cache"),
})
cacheDir := os.Getenv("PACKER_CACHE_DIR")
if cacheDir == "" {
cacheDir = "packer_cache"