|
|
|
|
@ -7,11 +7,16 @@ import (
|
|
|
|
|
"path/filepath"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var sharedStateDir := ioutil.TempDir(packer.ConfigTmpDir(), "state")
|
|
|
|
|
|
|
|
|
|
// Used to set variables which we need to access later in the build, where
|
|
|
|
|
// state bag and config information won't work
|
|
|
|
|
func sharedStateFilename(suffix string, buildName string) string {
|
|
|
|
|
uuid := os.Getenv("PACKER_RUN_UUID")
|
|
|
|
|
return filepath.Join(os.TempDir(), fmt.Sprintf("packer-%s-%s-%s", uuid, suffix, buildName))
|
|
|
|
|
if uuid == "" {
|
|
|
|
|
uuid="none"
|
|
|
|
|
}
|
|
|
|
|
return filepath.Join(sharedStateDir, fmt.Sprintf("%s-%s-%s", uuid, suffix, buildName))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func SetSharedState(key string, value string, buildName string) error {
|
|
|
|
|
|