chore: add bsusurrogate builder structure

This commit is contained in:
Marin Salinas 2019-01-23 15:53:41 -06:00 committed by Megan Marsh
parent e658a50880
commit c29816f496
2 changed files with 56 additions and 0 deletions

View File

@ -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()
}
}

View File

@ -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")
}
}