fix hook data loading
This commit is contained in:
parent
1679d9fb9d
commit
21a849354b
|
@ -23,8 +23,13 @@ import (
|
|||
// <nothing>
|
||||
|
||||
func PopulateProvisionHookData(state multistep.StateBag) map[string]interface{} {
|
||||
hookData := make(map[string]interface{})
|
||||
|
||||
// Load Builder hook data from state, if it has been set.
|
||||
// hookData := state.GetOk("generated_data").(map[string]interface{})
|
||||
hd, ok := state.GetOk("generated_data")
|
||||
if ok {
|
||||
hookData = hd.(map[string]interface{})
|
||||
}
|
||||
|
||||
// instance_id is placed in state by the builders.
|
||||
// Not yet implemented in Chroot, lxc/lxd, Azure, Qemu.
|
||||
|
@ -41,7 +46,7 @@ func PopulateProvisionHookData(state multistep.StateBag) map[string]interface{}
|
|||
// Warn user that the id isn't implemented
|
||||
hookData["ID"] = "ERR_ID_NOT_IMPLEMENTED_BY_BUILDER"
|
||||
}
|
||||
hookData["PACKER_RUN_UUID"] = os.Getenv("PACKER_RUN_UUID")
|
||||
hookData["PackerRunUUID"] = os.Getenv("PACKER_RUN_UUID")
|
||||
|
||||
// Read communicator data into hook data
|
||||
comm, ok := state.GetOk("communicator_config")
|
||||
|
|
Loading…
Reference in New Issue