Skip to content

Commit

Permalink
rename provisioner to CommentProvisioenr
Browse files Browse the repository at this point in the history
  • Loading branch information
SwampDragons committed Aug 23, 2019
1 parent 3d1c97a commit 5ef1563
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Cutting Edge Bubble Text
packer-provisioner-comment is a demonstration provisioner to help teach people
how to create and use their own Packer plugins. It uses cutting-edge ascii
art technology to add fancy bubble text comments to your Packer run output.
how to create and use their own third-party Packer plugins. It uses
cutting-edge ascii art technology to add fancy bubble text comments to your
Packer run output.

![bubble text](./screenshot.png)

Expand Down
5 changes: 1 addition & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import (
"github.com/hashicorp/packer/packer/plugin"
)

// Assume this implements packer.Builder
type Builder struct{}

func main() {
server, err := plugin.Server()
if err != nil {
panic(err)
}

server.RegisterProvisioner(new(Provisioner))
server.RegisterProvisioner(new(CommentProvisioner))
server.Serve()
}
9 changes: 3 additions & 6 deletions provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@ type Config struct {
ctx interpolate.Context
}

type Provisioner struct {
type CommentProvisioner struct {
config Config
}

func (p *Provisioner) Prepare(raws ...interface{}) error {
func (p *CommentProvisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{},
},
}, raws...)
if err != nil {
return err
Expand All @@ -39,7 +36,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
return nil
}

func (p *Provisioner) Provision(_ context.Context, ui packer.Ui, comm packer.Communicator) error {
func (p *CommentProvisioner) Provision(_ context.Context, ui packer.Ui, comm packer.Communicator) error {
if p.config.SendToUi {
if p.config.Fancy {
myFigure := figure.NewFigure(p.config.Comment, "", false)
Expand Down

0 comments on commit 5ef1563

Please sign in to comment.