Skip to content

Commit

Permalink
Upgrade to Packer 1.5
Browse files Browse the repository at this point in the history
The `Provisioner` interface has changed to accommodate a migration of
Packer configs to HCL2. We've run the Hashicorp-provided code generator and
checked in the resulting code, and updated the interface.
  • Loading branch information
Coleman McFarland committed Apr 3, 2020
1 parent d5d38ee commit f3a9e41
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bolt/provisioner.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:generate mapstructure-to-hcl2 -type Config
package bolt

import (
Expand All @@ -24,6 +25,7 @@ import (
"sync"
"unicode"

"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/common/adapter"
commonhelper "github.com/hashicorp/packer/helper/common"
Expand Down Expand Up @@ -85,6 +87,10 @@ type PassthroughTemplate struct {
WinRMPassword string
}

func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec {
return p.config.FlatMapstructure().HCL2Spec()
}

// Prepare the config data for provisioning
func (p *Provisioner) Prepare(raws ...interface{}) error {
p.done = make(chan struct{})
Expand Down Expand Up @@ -185,7 +191,7 @@ func (p *Provisioner) getVersion() error {
}

// Provision using the Puppet Bolt provisioner
func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator) error {
func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.Communicator, generatedData map[string]interface{}) error {
ui.Say("Provisioning with Puppet Bolt...")

k, err := newUserKey(p.config.SSHAuthorizedKeyFile)
Expand Down
70 changes: 70 additions & 0 deletions bolt/provisioner.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f3a9e41

Please sign in to comment.