decode data interface into generatedData

This commit is contained in:
Megan Marsh 2019-07-11 10:27:19 -07:00
parent f4c3501af5
commit ee336e6d12
1 changed files with 7 additions and 2 deletions

View File

@ -6,6 +6,8 @@ import (
"log"
"sync"
"time"
"github.com/hashicorp/packer/helper/config"
)
// A provisioner is responsible for installing and configuring software
@ -60,10 +62,13 @@ func (h *ProvisionHook) Run(ctx context.Context, name string, ui Ui, comm Commun
}
generatedData := NewProvisionHookData()
if data != nil {
generatedData = data.(ProvisionHookData)
err := config.Decode(&generatedData, &config.DecodeOpts{Interpolate: false}, data)
if err != nil {
log.Printf("Failed to decode provisioner generated data: %s", err)
}
log.Printf("Megan decoded data: %#v", generatedData)
if comm == nil {
return fmt.Errorf(
"No communicator found for provisioners! This is usually because the\n" +