close massive file overwrite hole with TempDir

pull/6942/head
Matthew Patton 7 years ago
parent 0a72297da8
commit d5c5306a97

@ -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 {

Loading…
Cancel
Save