From c29816f4961920c94cddb068ed9d10ab7c81f45b Mon Sep 17 00:00:00 2001 From: Marin Salinas Date: Wed, 23 Jan 2019 15:53:41 -0600 Subject: [PATCH] chore: add bsusurrogate builder structure --- builder/osc/bsusurrogate/builder.go | 41 ++++++++++++++++++++++++ builder/osc/bsusurrogate/builder_test.go | 15 +++++++++ 2 files changed, 56 insertions(+) create mode 100644 builder/osc/bsusurrogate/builder.go create mode 100644 builder/osc/bsusurrogate/builder_test.go diff --git a/builder/osc/bsusurrogate/builder.go b/builder/osc/bsusurrogate/builder.go new file mode 100644 index 000000000..a3b46d827 --- /dev/null +++ b/builder/osc/bsusurrogate/builder.go @@ -0,0 +1,41 @@ +// The bsusurrogate package contains a packer.Builder implementation that +// builds a new EBS-backed AMI using an ephemeral instance. +package bsusurrogate + +import ( + "log" + + "github.com/hashicorp/packer/common" + "github.com/hashicorp/packer/helper/multistep" + "github.com/hashicorp/packer/packer" + "github.com/hashicorp/packer/template/interpolate" +) + +const BuilderId = "digitalonus.osc.bsusurrogate" + +type Config struct { + common.PackerConfig `mapstructure:",squash"` + ctx interpolate.Context +} + +type Builder struct { + config Config + runner multistep.Runner +} + +func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { + log.Println("Preparing Outscale Builder...") + return nil, nil +} + +func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packer.Artifact, error) { + log.Println("Running Outscale Builder...") + return nil, nil +} + +func (b *Builder) Cancel() { + if b.runner != nil { + log.Println("Cancelling the step runner...") + b.runner.Cancel() + } +} diff --git a/builder/osc/bsusurrogate/builder_test.go b/builder/osc/bsusurrogate/builder_test.go new file mode 100644 index 000000000..d91f46af8 --- /dev/null +++ b/builder/osc/bsusurrogate/builder_test.go @@ -0,0 +1,15 @@ +package bsusurrogate + +import ( + "testing" + + "github.com/hashicorp/packer/packer" +) + +func TestBuilder_ImplementsBuilder(t *testing.T) { + var raw interface{} + raw = &Builder{} + if _, ok := raw.(packer.Builder); !ok { + t.Fatal("Builder should be a builder") + } +}