From ee336e6d124bfc56a1cbdd6470cd23a2190d4c4b Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 11 Jul 2019 10:27:19 -0700 Subject: [PATCH] decode data interface into generatedData --- packer/provisioner.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packer/provisioner.go b/packer/provisioner.go index c9e9a9f31..32a4d18c2 100644 --- a/packer/provisioner.go +++ b/packer/provisioner.go @@ -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" +